Changeset 255c4c8
- Timestamp:
- Mar 13, 2017, 10:23:21 PM (8 years ago)
- 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:
- b991cc1
- Parents:
- 20a33fb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Version.py
r20a33fb r255c4c8 3 3 4 4 5 for l in open('VERSION').readlines(): exec (l.strip()) 5 __version_info = {} 6 7 def get_version_info(): 8 # read from VERSION 9 # return dictionary filled with content of version 10 11 global __version_info 12 if not __version_info: 13 this_file_dir = os.path.dirname(os.path.abspath(__file__)) 14 version_file = os.path.join(this_file_dir, 'VERSION') 15 16 if not os.path.isfile(version_file): 17 raise SystemError("VERSION file not found.") 6 18 7 19 8 9 def get_aubio_version(): 10 # read from VERSION 11 this_file_dir = os.path.dirname(os.path.abspath(__file__)) 12 version_file = os.path.join(this_file_dir, 'VERSION') 13 14 if not os.path.isfile(version_file): 15 raise SystemError("VERSION file not found.") 16 17 for l in open(version_file).readlines(): 20 for l in open(version_file).readlines(): 18 21 #exec (l.strip()) 19 22 if l.startswith('AUBIO_MAJOR_VERSION'): 20 AUBIO_MAJOR_VERSION= int(l.split('=')[1])23 __version_info['AUBIO_MAJOR_VERSION'] = int(l.split('=')[1]) 21 24 if l.startswith('AUBIO_MINOR_VERSION'): 22 AUBIO_MINOR_VERSION= int(l.split('=')[1])25 __version_info['AUBIO_MINOR_VERSION'] = int(l.split('=')[1]) 23 26 if l.startswith('AUBIO_PATCH_VERSION'): 24 AUBIO_PATCH_VERSION= int(l.split('=')[1])27 __version_info['AUBIO_PATCH_VERSION'] = int(l.split('=')[1]) 25 28 if l.startswith('AUBIO_VERSION_STATUS'): 26 AUBIO_VERSION_STATUS= l.split('=')[1].strip()[1:-1]29 __version_info['AUBIO_VERSION_STATUS'] = l.split('=')[1].strip()[1:-1] 27 30 28 if AUBIO_MAJOR_VERSION is None or AUBIO_MINOR_VERSION is None \ 29 or AUBIO_PATCH_VERSION is None: 30 raise SystemError("Failed parsing VERSION file.") 31 if l.startswith('LIBAUBIO_LT_CUR'): 32 __version_info['LIBAUBIO_LT_CUR'] = int(l.split('=')[1]) 33 if l.startswith('LIBAUBIO_LT_REV'): 34 __version_info['LIBAUBIO_LT_REV'] = int(l.split('=')[1]) 35 if l.startswith('LIBAUBIO_LT_AGE'): 36 __version_info['LIBAUBIO_LT_AGE'] = int(l.split('=')[1]) 31 37 32 verstr = '.'.join(map(str, [AUBIO_MAJOR_VERSION, 33 AUBIO_MINOR_VERSION, 34 AUBIO_PATCH_VERSION])) 38 if len(__version_info) <6: 39 raise SystemError("Failed parsing VERSION file.") 35 40 36 37 # append sha to version in alpha release38 # MAJ.MIN.PATCH.{~git<sha> , ''}39 if '~alpha' in AUBIO_VERSION_STATUS :40 AUBIO_GIT_SHA = get_git_revision_hash()41 if AUBIO_GIT_SHA:42 AUBIO_VERSION_STATUS = '~git'+AUBIO_GIT_SHA43 41 44 if AUBIO_VERSION_STATUS is not None : 45 verstr += AUBIO_VERSION_STATUS 42 # switch version status with commit sha in alpha releases 43 if __version_info['AUBIO_VERSION_STATUS'] and \ 44 '~alpha' in __version_info['AUBIO_VERSION_STATUS'] : 45 AUBIO_GIT_SHA = get_git_revision_hash() 46 if AUBIO_GIT_SHA: 47 __version_info['AUBIO_VERSION_STATUS'] = '~git'+AUBIO_GIT_SHA 48 49 return __version_info 50 51 52 def get_aubio_version_tuple(): 53 d = get_version_info() 54 return (d['AUBIO_MAJOR_VERSION'],d['AUBIO_MINOR_VERSION'],d['AUBIO_PATCH_VERSION']) 55 56 def get_libaubio_version_tuple(): 57 d = get_version_info() 58 return (d['LIBAUBIO_LT_CUR'],d['LIBAUBIO_LT_REV'],d['LIBAUBIO_LT_AGE']) 59 60 def get_libaubio_version(): 61 return '%s.%s.%s'%get_libaubio_version_tuple() 62 63 def get_aubio_version(add_status = True): 64 # return string formatted as MAJ.MIN.PATCH.{~git<sha> , ''} 65 vdict = get_version_info() 66 verstr = '%s.%s.%s'%get_aubio_version_tuple() 67 if add_status and vdict['AUBIO_VERSION_STATUS']: 68 verstr += "."+vdict['AUBIO_VERSION_STATUS'] 46 69 return verstr 47 70 48 def get_aubio_pyversion( ):71 def get_aubio_pyversion(add_status = True): 49 72 # convert to version for python according to pep 440 50 73 # see https://www.python.org/dev/peps/pep-0440/ 51 74 # outputs MAJ.MIN.PATCH+a0{.git<sha> , ''} 52 verstr = get_aubio_version() 53 spl = verstr.split('~') 54 if len(spl)==2: 55 verstr = spl[0] + '+a0.'+spl[1] 56 57 # TODO: add rc, .dev, and .post suffixes, add numbering 75 vdict = get_version_info() 76 verstr = '%s.%s.%s'%get_aubio_version_tuple() 77 if add_status and vdict['AUBIO_VERSION_STATUS'] : 78 if '~git' in vdict['AUBIO_VERSION_STATUS']: 79 verstr += "+a0."+vdict['AUBIO_VERSION_STATUS'][1:] 80 elif '~alpha': 81 verstr += "+a0" 82 else: 83 raise SystemError("Aubio version statut not supported : %s"%vdict['AUBIO_VERSION_STATUS']) 58 84 return verstr 59 85 … … 82 108 83 109 84 85 # append sha to version in alpha release86 if AUBIO_VERSION_STATUS and '~alpha' in AUBIO_VERSION_STATUS :87 AUBIO_GIT_SHA = get_git_revision_hash()88 if AUBIO_GIT_SHA:89 AUBIO_VERSION_STATUS = '~git'+AUBIO_GIT_SHA -
wscript
r20a33fb r255c4c8 21 21 22 22 23 VERSION = '.'.join ([str(x) for x in [ 24 AUBIO_MAJOR_VERSION, 25 AUBIO_MINOR_VERSION, 26 AUBIO_PATCH_VERSION 27 ]]) + AUBIO_VERSION_STATUS 28 29 LIB_VERSION = '.'.join ([str(x) for x in [ 30 LIBAUBIO_LT_CUR, 31 LIBAUBIO_LT_REV, 32 LIBAUBIO_LT_AGE]]) 23 24 25 VERSION = get_aubio_version() 26 LIB_VERSION = get_libaubio_version() 33 27 34 28 top = '.' … … 135 129 ctx.env['DEST_OS'] = target_platform 136 130 131 version_dict = get_version_info(); 137 132 ctx.define('AUBIO_VERSION',VERSION) 138 ctx.define('AUBIO_MAJOR_VERSION', AUBIO_MAJOR_VERSION)139 ctx.define('AUBIO_MINOR_VERSION', AUBIO_MINOR_VERSION)140 ctx.define('AUBIO_PATCH_VERSION', AUBIO_PATCH_VERSION)141 ctx.define('AUBIO_VERSION_STATUS', AUBIO_VERSION_STATUS)133 ctx.define('AUBIO_MAJOR_VERSION', version_dict['AUBIO_MAJOR_VERSION']) 134 ctx.define('AUBIO_MINOR_VERSION', version_dict['AUBIO_MINOR_VERSION']) 135 ctx.define('AUBIO_PATCH_VERSION', version_dict['AUBIO_PATCH_VERSION']) 136 ctx.define('AUBIO_VERSION_STATUS', version_dict['AUBIO_VERSION_STATUS']) 142 137 143 138 if ctx.options.build_type == "debug":
Note: See TracChangeset
for help on using the changeset viewer.