SemVer 2.0.0 requires a plus for build metadata. https://semver.org/ `Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata SHOULD be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85.`
21 lines
678 B
Python
21 lines
678 B
Python
#!/usr/bin/env python
|
|
from sys import argv
|
|
from os import path, remove
|
|
|
|
current_path = path.dirname(path.realpath(__file__))
|
|
version_file_path = path.join(current_path, "compile_version_string.txt")
|
|
|
|
def get_version_string():
|
|
with open(version_file_path, "r") as file:
|
|
contents = file.readline()
|
|
return contents.strip('"')
|
|
|
|
def set_version_string(new_version_string):
|
|
remove(version_file_path)
|
|
with open(version_file_path, "w") as file:
|
|
file.write("\"" + new_version_string + "\"")
|
|
|
|
if __name__ == "__main__":
|
|
current_version = get_version_string()
|
|
new_version = current_version + "+" + argv[1]
|
|
set_version_string(new_version) |