1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Display git version in commit

This commit is contained in:
Julien Duponchelle 2017-02-15 12:58:12 +01:00
parent e04eb44a15
commit b7e5c08fdf
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -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)