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