From 4645a58feca31d997d6ef43e3a76c66fc7a7414c Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 18 Mar 2023 12:17:13 +0200 Subject: [PATCH] aedi: print source version when building from git repository --- aedi/builder.py | 3 +++ aedi/state.py | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/aedi/builder.py b/aedi/builder.py index 5d046e72..84d191d8 100644 --- a/aedi/builder.py +++ b/aedi/builder.py @@ -153,6 +153,9 @@ class Builder(object): self._create_prefix_directory() + if version := state.source_version(): + print(f'Building {version}') + if target.multi_platform and not state.xcode: self._build_multiple_platforms(target) else: diff --git a/aedi/state.py b/aedi/state.py index 0c09ec50..5eb0e99c 100644 --- a/aedi/state.py +++ b/aedi/state.py @@ -256,3 +256,14 @@ class BuildState: if sdk_version := self.sdk_version(): if sdk_version < minimum_version: raise RuntimeError('Minimum SDK version requirement is not met') + + def source_version(self): + version = '' + + args = ('git', f'--git-dir={self.source}/.git', 'describe', '--tags') + git_describe = subprocess.run(args, env=self.environment, capture_output=True) + + if git_describe.returncode == 0: + version = git_describe.stdout.decode('ascii') + + return version