Skip to content

Commit 414019d

Browse files
committed
Fix docs versioning
for Galaxy releases (e.g. 24.2 and 25.0) that have only tags with 2 dots.
1 parent 5b8aa60 commit 414019d

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

doc/source/conf.versioning.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,27 @@
3434
# Additional versions added below
3535
]
3636

37-
# Used for determining the latest stable release so the banner can be added to older releases.
38-
_stable = None
3937
# Use tags to determine versions - a stable version will have a branch before it's released, but not a tag.
4038
tags = check_output(("git", "tag")).decode().splitlines()
41-
for _tag in reversed(tags):
42-
if _tag.startswith("v") and _tag.count(".") == 1:
43-
# this version is released
44-
_ver = _tag[1:]
45-
if not _stable:
46-
_stable = _ver
47-
if Version(_ver) >= MIN_DOC_VERSION:
48-
simpleversioning_versions.append({"id": f"release_{_ver}", "name": _ver})
39+
found_versions = []
40+
for _tag in sorted(tags, reverse=True):
41+
if not _tag.startswith("v"):
42+
continue
43+
_ver_parts = _tag[1:].split(".")
44+
if len(_ver_parts) == 1:
45+
# No "."
46+
continue
47+
# Keep only major and minor version numbers
48+
_ver = ".".join(_ver_parts[:2])
49+
if Version(_ver) < MIN_DOC_VERSION:
50+
continue
51+
if _ver in found_versions:
52+
continue
53+
found_versions.append(_ver)
54+
simpleversioning_versions.append({"id": f"release_{_ver}", "name": _ver})
55+
56+
# The latest stable release
57+
_stable = found_versions[0] if found_versions else None
4958

5059
if re.fullmatch(r"release_\d{2}\.\d{1,2}", TARGET_GIT_BRANCH):
5160
if _stable:

0 commit comments

Comments
 (0)