version now supports . before postfix

This commit is contained in:
mazzol_a 2025-04-29 11:14:52 +02:00
parent 2815913d10
commit 27530fca31

View File

@ -19,10 +19,11 @@ def get_version():
return "0.0.0" return "0.0.0"
version = sys.argv[1] version = sys.argv[1]
try: try:
v = Version(version) # normalize according to PEP 440 specification v = Version(version) # normalizcheck if version follows PEP 440 specification
return v #replace -
return version.replace("-", ".")
except InvalidVersion as e: except InvalidVersion as e:
print(f"Invalid version {version}. Version format must follow semantic versioning format of python PEP 440 version identification specification.") print(f"Invalid version {version}. Version format must follow semantic versioning format of python PEP 440 version identification specification.")
sys.exit(1) sys.exit(1)
@ -31,7 +32,7 @@ def get_version():
def write_version_to_file(version): def write_version_to_file(version):
version_file_path = os.path.join(SCRIPT_DIR, "VERSION") version_file_path = os.path.join(SCRIPT_DIR, "VERSION")
with open(version_file_path, "w") as version_file: with open(version_file_path, "w") as version_file:
version_file.write(str(version)) version_file.write(version)
print(f"Version {version} written to VERSION file.") print(f"Version {version} written to VERSION file.")
# Main script # Main script