Files
SlimeVR-Tracker-ESP/scripts/get_git_commit.py
unlogisch04 1db61af823 create a fake version 0.7.0 version
due some problems in the actual 0.7.0 version and no good possiblitys to stop firmware updates on the clients make a fake 0.7.0 version from the version 0.6.3
2025-11-07 00:18:36 +01:00

48 lines
1.0 KiB
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", "--short", "HEAD"])
.strip()
.decode("utf-8")
)
except Exception:
revision = "NOT_GIT"
tag = ""
try:
tag = subprocess.check_output(["git", "--no-pager", "tag", "--sort", "-taggerdate", "--points-at" , "HEAD"]).strip().decode("utf-8")
if tag.startswith("v"):
tag = tag[1:]
except Exception:
tag = ""
branch = ""
try:
branch = (
subprocess.check_output(["git", "symbolic-ref", "--short", "-q", "HEAD"])
.strip()
.decode("utf-8")
)
except Exception:
branch = ""
output = f"-DGIT_REV='\"{revision}\"'"
#if tag != "":
# output += f" -DFIRMWARE_VERSION='\"{tag}\"'"
#elif branch != "":
# output += f" -DFIRMWARE_VERSION='\"{branch}\"'"
#else:
# output += f" -DFIRMWARE_VERSION='\"git-{revision}\"'"
output += f" -DFIRMWARE_VERSION='v0.7.0'"
print(output)