mirror of
https://github.com/YunoHost/apps.git
synced 2024-09-03 20:06:07 +02:00
Fix regex to replace version in manifest
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.
This commit is contained in:
parent
e408f7a99c
commit
dc2270a965
1 changed files with 1 additions and 1 deletions
|
@ -480,7 +480,7 @@ class AppAutoUpdater:
|
||||||
if is_main:
|
if is_main:
|
||||||
def repl(m: re.Match) -> str:
|
def repl(m: re.Match) -> str:
|
||||||
return m.group(1) + new_version + '~ynh1"'
|
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:
|
for old, new in replacements:
|
||||||
content = content.replace(old, new)
|
content = content.replace(old, new)
|
||||||
|
|
Loading…
Add table
Reference in a new issue