Mercurial > repos > petr-novak > dante
comparison dante.py @ 5:a38efa4937d7 draft
Uploaded
author | petr-novak |
---|---|
date | Wed, 03 Jul 2019 07:23:21 -0400 |
parents | 77d9f2ecb28a |
children | d0431a839606 |
comparison
equal
deleted
inserted
replaced
4:6a92134a105b | 5:a38efa4937d7 |
---|---|
411 else: | 411 else: |
412 return | 412 return |
413 | 413 |
414 | 414 |
415 def get_version(path, LAST_DB): | 415 def get_version(path, LAST_DB): |
416 branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", | 416 '''Return version is run from git repository ''' |
417 shell=True, | 417 try: |
418 cwd=path).decode('ascii').strip() | 418 branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", |
419 shorthash = subprocess.check_output("git log --pretty=format:'%h' -n 1 ", | 419 shell=True, |
420 shell=True, | 420 cwd=path).decode('ascii').strip() |
421 cwd=path).decode('ascii').strip() | 421 shorthash = subprocess.check_output("git log --pretty=format:'%h' -n 1 ", |
422 revcount = len(subprocess.check_output("git log --oneline", | 422 shell=True, |
423 shell=True, | 423 cwd=path).decode('ascii').strip() |
424 cwd=path).decode('ascii').split()) | 424 revcount = len(subprocess.check_output("git log --oneline", |
425 version_string = ( | 425 shell=True, |
426 "##-----------------------------------------------\n" | 426 cwd=path).decode('ascii').split()) |
427 "##PIPELINE VERSION : " | 427 version_string = ( |
428 "{branch}-rv-{revcount}({shorthash})\n" | 428 "##-----------------------------------------------\n" |
429 "##PROTEIN DATABASE VERSION : {PD}\n" | 429 "##PIPELINE VERSION : " |
430 "##-----------------------------------------------\n").format( | 430 "{branch}-rv-{revcount}({shorthash})\n" |
431 branch=branch, | 431 "##PROTEIN DATABASE VERSION : {PD}\n" |
432 shorthash=shorthash, | 432 "##-----------------------------------------------\n").format( |
433 revcount=revcount, | 433 branch=branch, |
434 PD=os.path.basename(LAST_DB)) | 434 shorthash=shorthash, |
435 revcount=revcount, | |
436 PD=os.path.basename(LAST_DB)) | |
437 except: | |
438 version_string = ( | |
439 "##-----------------------------------------------\n" | |
440 "##PROTEIN DATABASE VERSION : {PD}\n" | |
441 "##-----------------------------------------------\n").format( | |
442 PD=os.path.basename(LAST_DB) | |
443 ) | |
444 | |
435 return version_string | 445 return version_string |
436 | 446 |
437 | 447 |
438 def write_info(dom_gff_tmp, version_string): | 448 def write_info(dom_gff_tmp, version_string): |
439 dom_gff_tmp.write("{}\n".format(configuration.HEADER_GFF)) | 449 dom_gff_tmp.write("{}\n".format(configuration.HEADER_GFF)) |