ddnet/scripts/git_revision.py
heinrich5991 c645c6fd72 scripts/git_revision.py: Remove unused backcompat
Compatibility with Python 3.2 and lower was already removed earlier.
2023-03-19 18:01:51 +01:00

10 lines
333 B
Python

import subprocess
try:
git_hash = subprocess.check_output(["git", "rev-parse", "--short=16", "HEAD"], stderr=subprocess.DEVNULL).decode().strip()
definition = f'"{git_hash}"'
except FileNotFoundError:
definition = "0"
except subprocess.CalledProcessError:
definition = "0"
print(f"const char *GIT_SHORTREV_HASH = {definition};")