GRM-34: fix: handle same-version update in release.py

This commit is contained in:
2026-06-21 15:32:07 +00:00
parent 09699696c0
commit f0afa8171a
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -103,6 +103,8 @@ def update_init_version(new_version: str) -> None:
"""Update __version__ in __init__.py."""
with open(INIT_FILE) as f:
content = f.read()
if not re.search(r'^__version__\s*=\s*"[^"]*"', content, flags=re.MULTILINE):
raise click.ClickException(_("Could not find __version__ in {file}", file=INIT_FILE))
updated = re.sub(
r'^__version__\s*=\s*"[^"]*"',
f'__version__ = "{new_version}"',
@@ -110,8 +112,6 @@ def update_init_version(new_version: str) -> None:
count=1,
flags=re.MULTILINE,
)
if updated == content:
raise click.ClickException(_("Could not find __version__ in {file}", file=INIT_FILE))
with open(INIT_FILE, "w") as f:
f.write(updated)