hide AUBIO_GIT_SHA in release
authorMartin Hermant <martin.hermant@gmail.com>
Mon, 13 Mar 2017 16:48:53 +0000 (17:48 +0100)
committerMartin Hermant <martin.hermant@gmail.com>
Mon, 13 Mar 2017 16:48:53 +0000 (17:48 +0100)
fix py3 syntax error

python/lib/moresetuptools.py
wscript

index 5fdf43c..97d1aa3 100644 (file)
@@ -31,12 +31,14 @@ def get_aubio_version():
                                      AUBIO_MINOR_VERSION,
                                      AUBIO_PATCH_VERSION]))
 
-    AUBIO_GIT_SHA = get_git_revision_hash()
+    
     # append sha to version in alpha release
     # MAJ.MIN.PATCH.{~git<sha> , ''}
     if '~alpha' in AUBIO_VERSION_STATUS :
+        AUBIO_GIT_SHA = get_git_revision_hash()
         if AUBIO_GIT_SHA:
             AUBIO_VERSION_STATUS = '~git'+AUBIO_GIT_SHA
+
     if AUBIO_VERSION_STATUS is not None :
         verstr += AUBIO_VERSION_STATUS
     return verstr
diff --git a/wscript b/wscript
index f939ca4..2c9f790 100644 (file)
--- a/wscript
+++ b/wscript
@@ -33,9 +33,8 @@ def get_git_revision_hash( short=True):
                 exe_file = os.path.join(path, program)
                 if is_exe(exe_file):
                     return exe_file
-
         return None
-        
+
     if not which('git'):
         print('no git found on this system : can\'t get sha')
         return ""
@@ -48,12 +47,12 @@ def get_git_revision_hash( short=True):
     if short:
       gitcmd.append('--short')
     gitcmd.append('HEAD')
-    return subprocess.check_output(gitcmd).strip()
+    return str(subprocess.check_output(gitcmd).strip())
+
 
-AUBIO_GIT_SHA = get_git_revision_hash()
-""" append sha to version in alpha release
-"""
-if '~alpha' in AUBIO_VERSION_STATUS :
+# append sha to version in alpha release
+if AUBIO_VERSION_STATUS and '~alpha' in AUBIO_VERSION_STATUS :
+    AUBIO_GIT_SHA = get_git_revision_hash()
     if AUBIO_GIT_SHA:
         AUBIO_VERSION_STATUS = '~git'+AUBIO_GIT_SHA
 
@@ -179,7 +178,7 @@ def configure(ctx):
     ctx.define('AUBIO_MINOR_VERSION',AUBIO_MINOR_VERSION)
     ctx.define('AUBIO_PATCH_VERSION',AUBIO_PATCH_VERSION)
     ctx.define('AUBIO_VERSION_STATUS',AUBIO_VERSION_STATUS)
-    ctx.define('AUBIO_GIT_SHA',AUBIO_GIT_SHA)
+    ctx.define('AUBIO_GIT_SHA',AUBIO_GIT_SHA)
     if ctx.options.build_type == "debug":
         ctx.define('DEBUG', 1)
     else: