this_version.py: add +mods if git tree is not clean
authorPaul Brossier <piem@piem.org>
Thu, 23 Mar 2017 17:07:41 +0000 (18:07 +0100)
committerPaul Brossier <piem@piem.org>
Thu, 23 Mar 2017 17:07:41 +0000 (18:07 +0100)
this_version.py

index d78c878..cbafdb1 100644 (file)
@@ -106,8 +106,16 @@ def get_git_revision_hash(short=True):
         gitcmd.append('--short')
     gitcmd.append('HEAD')
     try:
-        outCmd = subprocess.check_output(gitcmd).strip().decode('utf8')
+        gitsha = subprocess.check_output(gitcmd).strip().decode('utf8')
     except Exception as e:
         print('git command error :%s' % e)
         return None
-    return outCmd
+
+    # check if we have a clean tree
+    gitcmd = ['git', '-C', aubio_dir, 'diff-index', '--quiet']
+    gitcmd.append('HEAD')
+    try:
+        subprocess.check_output(gitcmd).strip().decode('utf8')
+    except Exception as e:
+        gitsha += '+mods'
+    return gitsha