diff options
Diffstat (limited to 'publish/get_version.py')
-rw-r--r-- | publish/get_version.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/publish/get_version.py b/publish/get_version.py new file mode 100644 index 0000000..0c19c2d --- /dev/null +++ b/publish/get_version.py @@ -0,0 +1,14 @@ +import subprocess +import sys +import os + +ver = None + +versionPath = os.path.dirname(sys.argv[0]) + "/version.txt" +if os.path.exists(versionPath): + with open(versionPath, "r", encoding="utf8") as fp: + ver = fp.read() +else: + ver = subprocess.run("git describe --tags --dirty", capture_output=True, text=True).stdout or "UNKNOWN-" + subprocess.run("git describe --always --dirty", capture_output=True, text=True).stdout or "UNKNOWN" + +print(ver.strip()) |