comparison tools/mira4_0/mira4_bait.py @ 35:259891fce7fd draft

planemo upload for repository https://github.com/peterjc/galaxy_mira/tree/master/tools/mira4_0 commit e4c56df75150c82d3e9c4ac487c4209108e52412
author peterjc
date Wed, 09 Aug 2017 13:32:11 -0400 (2017-08-09)
parents 0785a6537f3e
children cee8f9005e43
comparison
equal deleted inserted replaced
34:0785a6537f3e 35:259891fce7fd
8 import shutil 8 import shutil
9 import subprocess 9 import subprocess
10 import sys 10 import sys
11 import time 11 import time
12 12
13 WRAPPER_VER = "0.0.10" # Keep in sync with the XML file 13 WRAPPER_VER = "0.0.11" # Keep in sync with the XML file
14 14
15 15
16 def get_version(mira_binary): 16 def get_version(mira_binary):
17 """Run MIRA to find its version number""" 17 """Run MIRA to find its version number"""
18 # At the commend line I would use: mira -v | head -n 1 18 # At the commend line I would use: mira -v | head -n 1
35 return line[line.index("version") + 1].rstrip(")") 35 return line[line.index("version") + 1].rstrip(")")
36 sys.exit("Could not determine MIRA version:\n%s" % ver) 36 sys.exit("Could not determine MIRA version:\n%s" % ver)
37 return ver.split("\n", 1)[0] 37 return ver.split("\n", 1)[0]
38 38
39 39
40 try: 40 if "MIRA4" in os.environ:
41 mira_path = os.environ["MIRA4"] 41 mira_path = os.environ["MIRA4"]
42 except KeyError: 42 mira_binary = os.path.join(mira_path, "mirabait")
43 sys.exit("Environment variable $MIRA4 not set") 43 if not os.path.isfile(mira_binary):
44 mira_binary = os.path.join(mira_path, "mirabait") 44 sys.exit("Missing mirabait under $MIRA4, %r\nFolder contained: %s"
45 if not os.path.isfile(mira_binary): 45 % (mira_binary, ", ".join(os.listdir(mira_path))))
46 sys.exit("Missing mirabait under $MIRA4, %r\nFolder contained: %s" 46 else:
47 % (mira_binary, ", ".join(os.listdir(mira_path)))) 47 sys.stderr.write("DEBUG: Since $MIRA4 is not set, assuming mira binaries are on $PATH.\n")
48 mira_path = None
49 mira_binary = "mirabait"
50
48 mira_ver = get_version(mira_binary) 51 mira_ver = get_version(mira_binary)
49 if not mira_ver.strip().startswith("4.0"): 52 if not mira_ver.strip().startswith("4.0"):
50 sys.exit("This wrapper is for MIRA V4.0, not:\n%s" % mira_ver) 53 sys.exit("This wrapper is for MIRA V4.0, not:\n%s" % mira_ver)
51 if "-v" in sys.argv or "--version" in sys.argv: 54 if "-v" in sys.argv or "--version" in sys.argv:
52 print("%s, MIRA wrapper version %s" % (mira_ver, WRAPPER_VER)) 55 print("%s, MIRA wrapper version %s" % (mira_ver, WRAPPER_VER))