Files
SlimeVR-Tracker-ESP/scripts/get_git_commit.py
unlogisch04 14f2752d4d feat: commit hash (#228)
Co-authored-by: DevMiner <tobigames200@gmail.com>
Co-authored-by: nekomona <nekomona@163.com>
2023-10-13 15:57:33 +03:00

20 lines
396 B
Python

import subprocess
import os
revision = ""
env_rev = os.environ.get("GIT_REV")
if not env_rev is None and env_rev != "":
revision = env_rev
else:
try:
revision = (
subprocess.check_output(["git", "rev-parse", "HEAD"])
.strip()
.decode("utf-8")
)
except Exception:
revision = "NOT_GIT"
print(f"'-DGIT_REV=\"{revision}\"'")