Mercurial > repos > petrn > repeatexplorer
diff seqclust @ 2:94877d063270 draft
Uploaded
author | petrn |
---|---|
date | Fri, 20 Dec 2019 11:14:11 +0000 |
parents | 2d43ed150abe |
children | 8f7909cf86df |
line wrap: on
line diff
--- a/seqclust Fri Dec 20 08:26:05 2019 +0000 +++ b/seqclust Fri Dec 20 11:14:11 2019 +0000 @@ -27,6 +27,11 @@ def get_version(path, tarean_mode): + # get git version + branch = "?" + shorthash = "?" + revcount = "?" + tag = "?" try: branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", shell=True, @@ -38,35 +43,55 @@ revcount = len(subprocess.check_output( "git log --oneline", shell=True, cwd=path).decode('ascii').split()) - try: - tag = subprocess.check_output("git describe --tags --abbrev=0", + tag = subprocess.check_output("git describe --tags --abbrev=0", cwd=path, shell=True).decode('ascii').strip() - except subprocess.CalledProcessError: - tag = " " + version_info = "{branch}-{tag}-{revcount}({shorthash})".format( + branch=branch, + shorthash=shorthash, + tag=tag, + revcount=revcount + ) + except subprocess.CalledProcessError: + # alernativelly - read it from file + try: + with open(path + "/version_info.txt", 'r') as f: + version_info = f.read() + except FileNotFoundError: + version_info = "version of pipeline not available!" - version_string = ( - "-------------------------------------" - "-------------------------------------\n" - "PIPELINE VERSION : " - "{branch}-{tag}-{revcount}({shorthash})\n\n" - "PROTEIN DATABASE VERSION : {PD}\n" - " md5 checksum : {PDmd5}\n\n" - "DNA DATABASE VERSION : {DD}\n" - " md5 checksum : {DDmd5}\n" - "-------------------------------------" - "-------------------------------------\n").format( - branch=branch, - shorthash=shorthash, - revcount=revcount, - tag=tag, - PD=os.path.basename(config.PROTEIN_DATABASE), - PDmd5=utils.md5checksum(config.PROTEIN_DATABASE + ".psq", fail_if_missing = not tarean_mode), - DD=os.path.basename(config.DNA_DATABASE), - DDmd5=utils.md5checksum(config.DNA_DATABASE + ".nsq")) + ## get database versions: + PD = "?" + PDmd5 = "?" + DD = "?" + DDmd5 = "?" + try: + PD = os.path.basename(config.PROTEIN_DATABASE) + PDmd5 = utils.md5checksum(config.PROTEIN_DATABASE + ".psq", + fail_if_missing=not tarean_mode) + DD = os.path.basename(config.DNA_DATABASE) + DDmd5 = utils.md5checksum(config.DNA_DATABASE + ".nsq") + except: + ## some problem with databases + pass + version_string = ( + "-------------------------------------" + "-------------------------------------\n" + "PIPELINE VERSION : " + "{version_info}\n\n" + "PROTEIN DATABASE VERSION : {PD}\n" + " md5 checksum : {PDmd5}\n\n" + "DNA DATABASE VERSION : {DD}\n" + " md5 checksum : {DDmd5}\n" + "-------------------------------------" + "-------------------------------------\n").format( - except: - version_string = "version of pipeline not available!" + version_info=version_info, + PD=PD, + PDmd5=PDmd5, + DD=DD, + DDmd5=DDmd5 + ) LOGGER.info(version_string) return version_string