Display git version in commit

pull/902/head
Julien Duponchelle 7 years ago
parent e04eb44a15
commit b7e5c08fdf
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -24,4 +24,16 @@
# number has been incremented)
__version__ = "2.0.0dev8"
# If it's a git checkout try to add the commit
if "dev" in __version__:
try:
import os
import subprocess
if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".git")):
r = subprocess.run(["git", "rev-parse", "--short", "HEAD"], stdout=subprocess.PIPE).stdout.decode().strip("\n")
__version__ += "-" + r
except Exception as e:
print(e)
__version_info__ = (2, 0, 0, -99)

Loading…
Cancel
Save