changeset 2:94877d063270 draft

Uploaded
author petrn
date Fri, 20 Dec 2019 11:14:11 +0000
parents 2d43ed150abe
children 8f7909cf86df
files build_shed_tarball.sh get_version.sh seqclust version_info.txt
diffstat 4 files changed, 63 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build_shed_tarball.sh	Fri Dec 20 11:14:11 2019 +0000
@@ -0,0 +1,4 @@
+#!/bin/sh
+./get_version.sh
+planemo shed_build .
+# TODO - add verification that version in xml match the version tag
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/get_version.sh	Fri Dec 20 11:14:11 2019 +0000
@@ -0,0 +1,8 @@
+#!/bin/sh
+# this file is copied into ./git/hooks.post-commit and post-checkout
+branch=$(git rev-parse --abbrev-ref HEAD)
+shorthash=$(git log --pretty=format:'%h' -n 1)
+revcount=$(git log --oneline | wc -l)
+tag=$(git describe --tags --abbrev=0)
+echo  "version:" ${tag}"-"${revcount}"("$shorthash") branch:" $branch > version_info.txt
+
--- 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/version_info.txt	Fri Dec 20 11:14:11 2019 +0000
@@ -0,0 +1,1 @@
+version: 0.3.6-430(1722c1f) branch: conda