ddnet/scripts/git_revision.py
heinrich5991 1387ee9a3a Regenerate version file on git changes
Previously, this file had to be manually deleted if you wanted to have a
new version compiled in.
2018-03-01 16:50:29 +01:00

8 lines
313 B
Python

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