From 4e5b8cb041e577523f01b27f3d9602316b58923a Mon Sep 17 00:00:00 2001 From: Baizhou Zhang Date: Wed, 8 Apr 2026 15:18:22 -0700 Subject: [PATCH] Fix get_version_tag.py to handle dot-separated post versions (#22385) Co-authored-by: Claude Opus 4.6 (1M context) --- python/tools/get_version_tag.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tools/get_version_tag.py b/python/tools/get_version_tag.py index 77c2d1188..0a54d8d86 100755 --- a/python/tools/get_version_tag.py +++ b/python/tools/get_version_tag.py @@ -31,11 +31,11 @@ def parse_version_tuple(tag: str) -> tuple: - Pre-release suffix gets a lower sort key than bare version: v0.5.10rc0 -> (0, 5, 10, 0, 0) # pre-release v0.5.10 -> (0, 5, 10, 1, 0) # stable (sorts higher) - v0.5.10post1 -> (0, 5, 10, 2, 1) # post-release (sorts highest) + v0.5.10.post1 -> (0, 5, 10, 2, 1) # post-release (sorts highest) """ v = tag.lstrip("v") # Split base version from suffix - m = re.match(r"^(\d+)\.(\d+)\.(\d+)(?:(rc|post)(\d+))?$", v) + m = re.match(r"^(\d+)\.(\d+)\.(\d+)(?:\.?(rc|post)(\d+))?$", v) if not m: return (0, 0, 0, 0, 0) major, minor, patch = int(m.group(1)), int(m.group(2)), int(m.group(3))