mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 05:58:19 +00:00
7379a64004
So far only done scripts directory, will do the rest if this is considered good
13 lines
388 B
Python
13 lines
388 B
Python
import errno
|
|
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 as e:
|
|
if e.errno != errno.ENOENT:
|
|
raise
|
|
definition = "0"
|
|
except subprocess.CalledProcessError:
|
|
definition = "0"
|
|
print(f"const char *GIT_SHORTREV_HASH = {definition};")
|