Browse Source

Gui logs current Git commit hash at startup

Matze 5 years ago
parent
commit
5cac934eed
2 changed files with 21 additions and 4 deletions
  1. 11 0
      KCG/kcg.py
  2. 10 4
      setup.py

+ 11 - 0
KCG/kcg.py

@@ -20,6 +20,17 @@ fileLogHandler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s: %(mess
 fileLogHandler.setLevel(0)
 logging.getLogger().addHandler(fileLogHandler)
 logging.info("==========[Start Application]===========")
+try:
+    import subprocess
+    val = subprocess.check_output(["git", "describe", "--always"]).strip()
+    val = str(val, 'utf-8')
+    print(val)
+    if "fatal" not in val:
+        logging.info('Current Git Hash: ' + val)
+
+except Exception as e:
+    print(e)
+    pass
 
 import KCG.base.kcgwidget as kcgw
 import KCG.config as config

+ 10 - 4
setup.py

@@ -1,13 +1,19 @@
 #!/usr/bin/python
 from setuptools import setup, find_packages
-
+import time, subprocess
 DESCRIPTION = "KCG KAPTURE Control Gui"
+git_count = subprocess.check_output(["git", "rev-list", "--count", "HEAD"]).strip()
+version_time = time.strftime("%d%m%y")
+VERSION = "0.3.2."+git_count+"."+version_time+"-beta"
+with open("KCG/VERSION", 'w') as vfile:
+    vfile.write(VERSION)
 
 setup(
     name='KCG',
-    version='0.3.2.197.0704-beta',
-    author='Patrick Schreiber',
-    author_email='uldfk@student.kit.edu',
+#    version='0.3.2.197.0704-beta',
+    version=VERSION,
+    author='Patrick Schreiber, Matthias Martin',
+    author_email='uldfk@student.kit.edu, uadse@student.kit.edu',
 #    license='GPL',
     description=DESCRIPTION,
     long_description=DESCRIPTION,