From 48c41dad9be1d2163af4e438751416921f2867e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 6 Mar 2024 23:10:48 +0100 Subject: [PATCH] Fix regex to replace version in manifest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This regex is used to find (textually, not via toml parser) where to replace the version number in the Manifest. Until now it was only supporting version numbers containing dots and digits. I changed that to version numbers containing anything but ~ and " to handle version numbers with dashes, or manually written version numbers that might be invalid (if someone litteraly writes `version = "x.y~ynh1"). We don’t actually care about the version number we match against because we just replace it. --- autoupdate_app_sources/autoupdate_app_sources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoupdate_app_sources/autoupdate_app_sources.py b/autoupdate_app_sources/autoupdate_app_sources.py index 9f6fe70..b222a8e 100755 --- a/autoupdate_app_sources/autoupdate_app_sources.py +++ b/autoupdate_app_sources/autoupdate_app_sources.py @@ -480,7 +480,7 @@ class AppAutoUpdater: if is_main: def repl(m: re.Match) -> str: return m.group(1) + new_version + '~ynh1"' - content = re.sub(r"(\s*version\s*=\s*[\"\'])([\d\.]+)(\~ynh\d+[\"\'])", repl, content) + content = re.sub(r"(\s*version\s*=\s*[\"\'])([^~\"\']+)(\~ynh\d+[\"\'])", repl, content) for old, new in replacements: content = content.replace(old, new)