mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
13a8dfa307
and fix occurences
18 lines
495 B
Python
18 lines
495 B
Python
import errno
|
|
import subprocess
|
|
try:
|
|
from subprocess import DEVNULL
|
|
except ImportError:
|
|
import os
|
|
DEVNULL = open(os.devnull, 'wb')
|
|
try:
|
|
git_hash = subprocess.check_output(["git", "rev-parse", "--short=16", "HEAD"], stderr=DEVNULL).decode().strip()
|
|
definition = '"{}"'.format(git_hash)
|
|
except FileNotFoundError as e:
|
|
if e.errno != errno.ENOENT:
|
|
raise
|
|
definition = "0"
|
|
except subprocess.CalledProcessError:
|
|
definition = "0"
|
|
print("const char *GIT_SHORTREV_HASH = {};".format(definition))
|