Changeset 638be5f
- Timestamp:
- Mar 13, 2017, 9:20:38 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:
- 20a33fb
- Parents:
- d24b5c7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Version.py
rd24b5c7 r638be5f 1 1 2 2 import os 3 4 3 5 for l in open('VERSION').readlines(): exec (l.strip()) 4 6 5 # def get_git_revision_hash( short=True):6 # import os7 # def which(program):8 # def is_exe(fpath):9 # return os.path.isfile(fpath) and os.access(fpath, os.X_OK)10 11 # fpath, fname = os.path.split(program)12 # if fpath:13 # if is_exe(program):14 # return program15 # else:16 # for path in os.environ["PATH"].split(os.pathsep):17 # path = path.strip('"')18 # exe_file = os.path.join(path, program)19 # if is_exe(exe_file):20 # return exe_file21 # return None22 23 # if not which('git') :24 # # print('no git found on this system : can\'t get sha')25 # return ""26 # if not os.path.isdir('.git'):27 # # print('Version : not in git repository : can\'t get sha')28 # return ""29 30 # import subprocess31 # aubio_dir = os.path.abspath(os.curdir)32 # if not os.path.exists(aubio_dir):33 # raise SystemError("git / root folder not found")34 # gitcmd = ['git','-C',aubio_dir ,'rev-parse']35 # if short:36 # gitcmd.append('--short')37 # gitcmd.append('HEAD')38 # outCmd = subprocess.check_output(gitcmd).strip().decode('utf8')39 # return outCmd40 7 41 8 … … 85 52 spl = verstr.split('~') 86 53 if len(spl)==2: 87 verstr = spl[0] + '+a 1.'+spl[1]54 verstr = spl[0] + '+a0.'+spl[1] 88 55 89 56 # TODO: add rc, .dev, and .post suffixes, add numbering … … 93 60 94 61 def get_git_revision_hash( short=True): 95 def which(program):96 97 def is_exe(fpath):98 return os.path.isfile(fpath) and os.access(fpath, os.X_OK)99 62 100 fpath, fname = os.path.split(program)101 if fpath:102 if is_exe(program):103 return program104 else:105 for path in os.environ["PATH"].split(os.pathsep):106 path = path.strip('"')107 exe_file = os.path.join(path, program)108 if is_exe(exe_file):109 return exe_file110 111 return None112 113 if not which('git') :114 # print('no git found on this system : can\'t get sha')115 return ""116 63 if not os.path.isdir('.git'): 117 64 # print('Version : not in git repository : can\'t get sha') 118 return ""65 return None 119 66 120 67 import subprocess … … 126 73 gitcmd.append('--short') 127 74 gitcmd.append('HEAD') 128 outCmd = subprocess.check_output(gitcmd).strip().decode('utf8') 75 try: 76 outCmd = subprocess.check_output(gitcmd).strip().decode('utf8') 77 except Exception as e: 78 print ('git command error :%s'%e) 79 return None 129 80 return outCmd 130 81
Note: See TracChangeset
for help on using the changeset viewer.