diff --git a/.appveyor.yml b/.appveyor.yml index bda5076..f4dcbb0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,7 +26,7 @@ clone_depth: 1 init: - set TAG_NAME=%APPVEYOR_REPO_TAG_NAME% - - python ./build_scripts/append_to_version_file.py $(APPVEYOR_REPO_COMMIT) > ./build_scripts/compile_version_string.txt + - python ./build_scripts/append_to_version_file.py %APPVEYOR_REPO_COMMIT% build_script: - python ./build_scripts/run-clang-format.py ./src -r --clang-format-executable "C:\Program Files\LLVM\bin\clang-format.exe" --color always diff --git a/build_scripts/append_to_version_file.py b/build_scripts/append_to_version_file.py index 30d9f40..c1ddb60 100644 --- a/build_scripts/append_to_version_file.py +++ b/build_scripts/append_to_version_file.py @@ -1,14 +1,21 @@ #!/usr/bin/env python from sys import argv -from os import path +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(): - dir_path = path.dirname(path.realpath(__file__)) - with open(path.join(dir_path, "compile_version_string.txt"), "r") as file: + 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] - print("\"" + new_version + "\"") \ No newline at end of file + set_version_string(new_version) \ No newline at end of file