From 414019da342aef4e4d64bb56078dc25e7f6b511f Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Sat, 21 Jun 2025 20:00:16 +0100 Subject: [PATCH] Fix docs versioning for Galaxy releases (e.g. 24.2 and 25.0) that have only tags with 2 dots. --- doc/source/conf.versioning.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/source/conf.versioning.py b/doc/source/conf.versioning.py index 6aef635aa0c..9ed1cd9f04b 100644 --- a/doc/source/conf.versioning.py +++ b/doc/source/conf.versioning.py @@ -34,18 +34,27 @@ simpleversioning_versions = [ # Additional versions added below ] -# Used for determining the latest stable release so the banner can be added to older releases. -_stable = None # Use tags to determine versions - a stable version will have a branch before it's released, but not a tag. tags = check_output(("git", "tag")).decode().splitlines() -for _tag in reversed(tags): - if _tag.startswith("v") and _tag.count(".") == 1: - # this version is released - _ver = _tag[1:] - if not _stable: - _stable = _ver - if Version(_ver) >= MIN_DOC_VERSION: - simpleversioning_versions.append({"id": f"release_{_ver}", "name": _ver}) +found_versions = [] +for _tag in sorted(tags, reverse=True): + if not _tag.startswith("v"): + continue + _ver_parts = _tag[1:].split(".") + if len(_ver_parts) == 1: + # No "." + continue + # Keep only major and minor version numbers + _ver = ".".join(_ver_parts[:2]) + if Version(_ver) < MIN_DOC_VERSION: + continue + if _ver in found_versions: + continue + found_versions.append(_ver) + simpleversioning_versions.append({"id": f"release_{_ver}", "name": _ver}) + +# The latest stable release +_stable = found_versions[0] if found_versions else None if re.fullmatch(r"release_\d{2}\.\d{1,2}", TARGET_GIT_BRANCH): if _stable: