mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24:18 +00:00
Python 2 support for scripts/git_revision.py
on error /o\
This commit is contained in:
parent
fca81553ba
commit
b285d777f3
|
@ -1,7 +1,16 @@
|
||||||
|
import errno
|
||||||
import subprocess
|
import subprocess
|
||||||
|
try:
|
||||||
|
FileNotFoundError
|
||||||
|
except NameError:
|
||||||
|
FileNotFoundError = OSError
|
||||||
try:
|
try:
|
||||||
git_hash = subprocess.check_output(["git", "rev-parse", "--short=16", "HEAD"], stderr=None).decode().strip()
|
git_hash = subprocess.check_output(["git", "rev-parse", "--short=16", "HEAD"], stderr=None).decode().strip()
|
||||||
definition = '"{}"'.format(git_hash)
|
definition = '"{}"'.format(git_hash)
|
||||||
except (FileNotFoundError, subprocess.CalledProcessError):
|
except FileNotFoundError as e:
|
||||||
|
if e.errno != errno.ENOENT:
|
||||||
|
raise
|
||||||
|
definition = "0"
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
definition = "0";
|
definition = "0";
|
||||||
print("const char *GIT_SHORTREV_HASH = {};".format(definition))
|
print("const char *GIT_SHORTREV_HASH = {};".format(definition))
|
||||||
|
|
Loading…
Reference in a new issue