Skip to content

Commit

Permalink
minor fix in autogeneration of app version
Browse files Browse the repository at this point in the history
  • Loading branch information
keighrim committed Mar 31, 2024
1 parent 38631a7 commit 3462b54
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions clams/appmetadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ def generate_app_version(cwd=None):
gitcmd = shutil.which('git')
gitdir = (Path(sys.modules["__main__"].__file__).parent.resolve() if cwd is None else Path(cwd)) / '.git'
if gitcmd is not None and gitdir.exists():
proc = subprocess.run([gitcmd, '--git-dir', str(gitdir), 'describe', '--tags', '--always'],
capture_output=True, check=True)
return proc.stdout.decode('utf8').strip()
try:
proc = subprocess.run([gitcmd, '--git-dir', str(gitdir), 'describe', '--tags', '--always'],

Check warning on line 42 in clams/appmetadata/__init__.py

View check run for this annotation

Codecov / codecov/patch

clams/appmetadata/__init__.py#L41-L42

Added lines #L41 - L42 were not covered by tests
capture_output=True, check=True)
return proc.stdout.decode('utf8').strip()
except subprocess.CalledProcessError:
return unresolved_app_version_num

Check warning on line 46 in clams/appmetadata/__init__.py

View check run for this annotation

Codecov / codecov/patch

clams/appmetadata/__init__.py#L44-L46

Added lines #L44 - L46 were not covered by tests
elif app_version_envvar_key in os.environ:
return os.environ[app_version_envvar_key]
else:
Expand Down

0 comments on commit 3462b54

Please sign in to comment.