Fix oopsie from me using version.py on an existing version

This commit is contained in:
Pieter-Jan Briers
2024-08-11 16:33:00 +02:00
parent 6599f9565e
commit 2c3cc070a6
2 changed files with 8 additions and 3 deletions

View File

@@ -56,9 +56,6 @@ END TEMPLATE-->
## 230.0.0
## 223.0.0
### New features
* Added `InterpolatedStringHandlerArgumentAttribute` to the sandbox whitelist.

View File

@@ -45,6 +45,10 @@ def write_version(version: str, file_only: bool):
# Verify
verify_version(version)
if tag_exists(version):
print(f"Version tag already exists: v{version}")
sys.exit(1)
update_release_notes(version)
# Update
@@ -111,4 +115,8 @@ def undo_version(version: str):
subprocess.run(["git", "reset", "--keep", "HEAD^"], check=True)
print("Done (deleted commit saved as " + savename + ")")
def tag_exists(version: str):
result = subprocess.run(["git", "tag", "-l", "v" + version], stdout=subprocess.PIPE, encoding="utf-8")
return bool(result.stdout.strip())
main()