diff --git a/docs/conf.py b/docs/conf.py index f1bd4fb..e8bca74 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -39,23 +39,22 @@ .strip() .split() ) + print(f"- Version : {version}") print(f"- Git hash : {git_hash}") print(f"- All tags : {all_tags}") print(f"- HEAD tags : {head_tags}") - # Check if any HEAD tag matches the version pattern - version_tag = f"v{version}" - is_version_tagged = version_tag in head_tags + # Check if current commit has a version tag + is_version_tagged = f"v{version}" in head_tags + release = version if is_version_tagged else f"{version}+{git_hash}" - if not is_version_tagged: - release = f"{version}+{git_hash}" - print(f"- Docs version : {release} (not a version tagged commit)") + if is_version_tagged: + status = f"({git_hash} is version tagged as v{version})" else: - release = version - print( - f"- Docs version: {release} ({git_hash} is version tagged as {version_tag})" - ) + status = "(not a version tagged commit)" + print(f"- Docs version: {release} {status}") + except subprocess.CalledProcessError: release = version print(f"- Docs version : {release} (cannot detect git information)")