From 76887a0edcd459ec86eac093cb351a8fc8bb7e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sat, 17 Feb 2024 19:06:20 +0100 Subject: [PATCH] Fix version numbering in source autoupdating (remove leading v) --- .../autoupdate_app_sources.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/autoupdate_app_sources/autoupdate_app_sources.py b/autoupdate_app_sources/autoupdate_app_sources.py index fdfd74a..32cef7c 100755 --- a/autoupdate_app_sources/autoupdate_app_sources.py +++ b/autoupdate_app_sources/autoupdate_app_sources.py @@ -250,13 +250,16 @@ class AppAutoUpdater: def apply_version_regex(tag: str) -> Optional[str]: # First preprocessing according to the manifest version_regex… - if not version_regex: - return tag - match = re.match(version_regex, tag) - if match is None: - return None - # Basically: either groupdict if named capture gorups, sorted by names, or groups() - return ".".join(dict(sorted(match.groupdict().items())).values() or match.groups()) + if version_regex: + match = re.match(version_regex, tag) + if match is None: + return None + # Basically: either groupdict if named capture gorups, sorted by names, or groups() + tag = ".".join(dict(sorted(match.groupdict().items())).values() or match.groups()) + + # Then remove leading v + tag = tag.lstrip("v") + return tag def version_numbers(tag: str) -> Optional[tuple[int, ...]]: filter_keywords = ["start", "rc", "beta", "alpha"]