Changeset aab682e for wscript


Ignore:
Timestamp:
Mar 13, 2017, 7:49:56 PM (7 years ago)
Author:
Martin Hermant <martin.hermant@gmail.com>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler
Children:
0a2a8dd
Parents:
79ef3b3
Message:

unify version parsing in Version.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wscript

    r79ef3b3 raab682e  
    1616
    1717# source VERSION
    18 for l in open('VERSION').readlines(): exec (l.strip())
    19 
    20 def get_git_revision_hash( short=True):
    21     import os
    22     def which(program):
    23         def is_exe(fpath):
    24             return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
    25 
    26         fpath, fname = os.path.split(program)
    27         if fpath:
    28             if is_exe(program):
    29                 return program
    30         else:
    31             for path in os.environ["PATH"].split(os.pathsep):
    32                 path = path.strip('"')
    33                 exe_file = os.path.join(path, program)
    34                 if is_exe(exe_file):
    35                     return exe_file
    36         return None
    37 
    38     if not which('git'):
    39         print('no git found on this system : can\'t get sha')
    40         return ""
    41 
    42     import subprocess
    43     aubio_dir = os.path.abspath(os.curdir)
    44     if not os.path.exists(aubio_dir):
    45         raise SystemError("git / root folder not found")
    46     gitcmd = ['git','-C',aubio_dir ,'rev-parse']
    47     if short:
    48       gitcmd.append('--short')
    49     gitcmd.append('HEAD')
    50     return str(subprocess.check_output(gitcmd).strip())
    51 
    52 
    53 # append sha to version in alpha release
    54 if AUBIO_VERSION_STATUS and '~alpha' in AUBIO_VERSION_STATUS :
    55     AUBIO_GIT_SHA = get_git_revision_hash()
    56     if AUBIO_GIT_SHA:
    57         AUBIO_VERSION_STATUS = '~git'+AUBIO_GIT_SHA
    58 
    59 
     18
     19
     20from Version import *
    6021
    6122
     
    179140    ctx.define('AUBIO_PATCH_VERSION',AUBIO_PATCH_VERSION)
    180141    ctx.define('AUBIO_VERSION_STATUS',AUBIO_VERSION_STATUS)
    181     # ctx.define('AUBIO_GIT_SHA',AUBIO_GIT_SHA)
     142   
    182143    if ctx.options.build_type == "debug":
    183144        ctx.define('DEBUG', 1)
Note: See TracChangeset for help on using the changeset viewer.