Skip to content

Commit

Permalink
Update version str error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmig committed Aug 9, 2023
1 parent 5885f4a commit c21187d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions workflow/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ def get_input_fasta(wildcards):


def get_version_str(base_dir: str) -> str:
if not Path(f"{base_dir}/.git").is_dir():
print("Not a git repository!")
try:
last_tag_description = subprocess.check_output(
["git", f"--git-dir={base_dir}/.git", "describe", "--always"]
).strip().decode("utf-8")
except subprocess.CalledProcessError as e:
print(f"Could not find git repo! Error: '{e}'")
return "no version available"
last_tag_description = subprocess.check_output(
["git", f"--git-dir={base_dir}/.git", "describe", "--always"]
).strip().decode("utf-8")
if last_tag_description.startswith("v"):
return last_tag_description
else:
Expand Down

0 comments on commit c21187d

Please sign in to comment.