# HG changeset patch # User petr-novak # Date 1562153001 14400 # Node ID a38efa4937d7249344d7a27a8b88acfd9a4ab9a8 # Parent 6a92134a105b9696f03f567ced141cc73096024f Uploaded diff -r 6a92134a105b -r a38efa4937d7 dante.py --- a/dante.py Wed Jul 03 05:29:51 2019 -0400 +++ b/dante.py Wed Jul 03 07:23:21 2019 -0400 @@ -413,25 +413,35 @@ def get_version(path, LAST_DB): - branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", - shell=True, - cwd=path).decode('ascii').strip() - shorthash = subprocess.check_output("git log --pretty=format:'%h' -n 1 ", - shell=True, - cwd=path).decode('ascii').strip() - revcount = len(subprocess.check_output("git log --oneline", - shell=True, - cwd=path).decode('ascii').split()) - version_string = ( - "##-----------------------------------------------\n" - "##PIPELINE VERSION : " - "{branch}-rv-{revcount}({shorthash})\n" - "##PROTEIN DATABASE VERSION : {PD}\n" - "##-----------------------------------------------\n").format( - branch=branch, - shorthash=shorthash, - revcount=revcount, - PD=os.path.basename(LAST_DB)) + '''Return version is run from git repository ''' + try: + branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", + shell=True, + cwd=path).decode('ascii').strip() + shorthash = subprocess.check_output("git log --pretty=format:'%h' -n 1 ", + shell=True, + cwd=path).decode('ascii').strip() + revcount = len(subprocess.check_output("git log --oneline", + shell=True, + cwd=path).decode('ascii').split()) + version_string = ( + "##-----------------------------------------------\n" + "##PIPELINE VERSION : " + "{branch}-rv-{revcount}({shorthash})\n" + "##PROTEIN DATABASE VERSION : {PD}\n" + "##-----------------------------------------------\n").format( + branch=branch, + shorthash=shorthash, + revcount=revcount, + PD=os.path.basename(LAST_DB)) + except: + version_string = ( + "##-----------------------------------------------\n" + "##PROTEIN DATABASE VERSION : {PD}\n" + "##-----------------------------------------------\n").format( + PD=os.path.basename(LAST_DB) + ) + return version_string