Changeset 1eb8c0e for wscript


Ignore:
Timestamp:
Mar 13, 2017, 5:10:55 PM (3 years ago)
Author:
Martin Hermant <martin.hermant@gmail.com>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, sampler
Children:
8259e09
Parents:
67b6618
Message:

aubio version :
aubio-c / aubio-py add git commit support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wscript

    r67b6618 r1eb8c0e  
    1717# source VERSION
    1818for l in open('VERSION').readlines(): exec (l.strip())
     19
     20def 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
     37        return None
     38       
     39    if not which('git'):
     40        print 'no git found on this system : can\'t get sha'
     41        return ""
     42
     43    import subprocess
     44    aubio_dir = os.path.abspath(os.curdir)
     45    if not os.path.exists(aubio_dir):
     46        raise SystemError("git / root folder not found")
     47    gitcmd = ['git','-C',aubio_dir ,'rev-parse']
     48    if short:
     49      gitcmd.append('--short')
     50    gitcmd.append('HEAD')
     51    return subprocess.check_output(gitcmd).strip()
     52
     53AUBIO_GIT_SHA = get_git_revision_hash()
     54""" append sha to version in alpha release
     55"""
     56if '~alpha' in AUBIO_VERSION_STATUS :
     57    if AUBIO_GIT_SHA:
     58        AUBIO_VERSION_STATUS = '~git'+AUBIO_GIT_SHA
     59
     60
     61
    1962
    2063VERSION = '.'.join ([str(x) for x in [
     
    132175    ctx.env['DEST_OS'] = target_platform
    133176
     177    ctx.define('AUBIO_VERSION',VERSION)
     178    ctx.define('AUBIO_MAJOR_VERSION',AUBIO_MAJOR_VERSION)
     179    ctx.define('AUBIO_MINOR_VERSION',AUBIO_MINOR_VERSION)
     180    ctx.define('AUBIO_PATCH_VERSION',AUBIO_PATCH_VERSION)
     181    ctx.define('AUBIO_VERSION_STATUS',AUBIO_VERSION_STATUS)
     182    ctx.define('AUBIO_GIT_SHA',AUBIO_GIT_SHA)
    134183    if ctx.options.build_type == "debug":
    135184        ctx.define('DEBUG', 1)
Note: See TracChangeset for help on using the changeset viewer.