Mercurial > repos > fubar > toolfactory_gtn
comparison toolfactory/rgToolFactory2.py @ 3:c4f192ec521c draft
Uploaded
| author | fubar |
|---|---|
| date | Tue, 20 Apr 2021 05:30:52 +0000 |
| parents | b65ec4f387b9 |
| children |
comparison
equal
deleted
inserted
replaced
| 2:b65ec4f387b9 | 3:c4f192ec521c |
|---|---|
| 1041 """planemo is a requirement so is available for testing but needs a | 1041 """planemo is a requirement so is available for testing but needs a |
| 1042 different call if in the biocontainer - see above | 1042 different call if in the biocontainer - see above |
| 1043 and for generating test outputs if command or test overrides are | 1043 and for generating test outputs if command or test overrides are |
| 1044 supplied test outputs are sent to repdir for display | 1044 supplied test outputs are sent to repdir for display |
| 1045 """ | 1045 """ |
| 1046 penv = os.environ | |
| 1047 phome = penv['HOME'] | |
| 1048 isDocker = os.path.exists('/.dockerenv') | |
| 1049 if isDocker: # use the volume if it exists | |
| 1050 phome = '/home/planemo' | |
| 1051 if os.path.exists(phome): # is mounted | |
| 1052 home = phome | |
| 1053 else: | |
| 1054 home = '/tmp/planemo' # this will be brutal but otherwise /home/galaxy | |
| 1055 os.mkdir('/tmp/planemo') | |
| 1056 penv["HOME"] = phome | |
| 1057 path = penv['PATH'] | |
| 1058 penv['PATH'] = '%s:%s' % (phome,path) | |
| 1059 print(f"#### set home to {phome} with path={penv['PATH']}") | |
| 1060 #pconfig = os.path.join(phome,'.planemo.yml') | |
| 1061 #penv["PLANEMO_GLOBAL_CONFIG_PATH"] = pconfig | |
| 1062 # self.set_planemo_galaxy_root(self.args.galaxy_root, config_path=pconfig) | |
| 1046 xreal = "%s.xml" % self.tool_name | 1063 xreal = "%s.xml" % self.tool_name |
| 1047 tool_test_path = os.path.join( | 1064 tool_test_path = os.path.join( |
| 1048 self.repdir, f"{self.tool_name}_planemo_test_report.html" | 1065 self.repdir, f"{self.tool_name}_planemo_test_report.html" |
| 1049 ) | 1066 ) |
| 1050 if os.path.exists(self.tlog): | 1067 if os.path.exists(self.tlog): |
| 1052 else: | 1069 else: |
| 1053 tout = open(self.tlog, "w") | 1070 tout = open(self.tlog, "w") |
| 1054 cll = [ | 1071 cll = [ |
| 1055 "planemo", | 1072 "planemo", |
| 1056 "test", | 1073 "test", |
| 1074 "--galaxy_python_version", | |
| 1075 self.args.python_version, | |
| 1057 "--test_data", | 1076 "--test_data", |
| 1058 os.path.abspath(self.testdir), | 1077 os.path.abspath(self.testdir), |
| 1059 "--test_output", | 1078 "--test_output", |
| 1060 os.path.abspath(tool_test_path), | 1079 os.path.abspath(tool_test_path), |
| 1061 "--galaxy_root", | 1080 ## "--galaxy_root", |
| 1062 self.args.galaxy_root, | 1081 ## self.args.galaxy_root, |
| 1063 "--update_test_data", | 1082 "--update_test_data", |
| 1064 os.path.abspath(xreal), | 1083 os.path.abspath(xreal), |
| 1065 ] | 1084 ] |
| 1066 p = subprocess.run( | 1085 p = subprocess.run( |
| 1067 cll, | 1086 cll, |
| 1087 env = penv, | |
| 1068 shell=False, | 1088 shell=False, |
| 1069 cwd=self.tooloutdir, | 1089 cwd=self.tooloutdir, |
| 1070 stderr=tout, | 1090 stderr=tout, |
| 1071 stdout=tout, | 1091 stdout=tout, |
| 1072 ) | 1092 ) |
| 1073 tout.close() | 1093 tout.close() |
| 1074 return p.returncode | 1094 return p.returncode |
| 1095 | |
| 1096 def set_planemo_galaxy_root(self, galaxyroot, config_path): | |
| 1097 # planemo tries to write to ~/.planemo - trying to convince it otherwise | |
| 1098 CONFIG_TEMPLATE = """## Planemo Global Configuration File. | |
| 1099 ## Everything in this file is completely optional - these values can all be | |
| 1100 ## configured via command line options for the corresponding commands. | |
| 1101 ## Specify a default galaxy_root for test and server commands here. | |
| 1102 galaxy_root: %s | |
| 1103 ## Username used with toolshed(s). | |
| 1104 #shed_username: "<TODO>" | |
| 1105 sheds: | |
| 1106 # For each tool shed you wish to target, uncomment key or both email and | |
| 1107 # password. | |
| 1108 toolshed: | |
| 1109 #key: "<TODO>" | |
| 1110 #email: "<TODO>" | |
| 1111 #password: "<TODO>" | |
| 1112 testtoolshed: | |
| 1113 #key: "<TODO>" | |
| 1114 #email: "<TODO>" | |
| 1115 #password: "<TODO>" | |
| 1116 local: | |
| 1117 #key: "<TODO>" | |
| 1118 #email: "<TODO>" | |
| 1119 #password: "<TODO>" | |
| 1120 """ | |
| 1121 if not os.path.exists(config_path): | |
| 1122 with open(config_path, "w") as f: | |
| 1123 f.write(CONFIG_TEMPLATE % galaxyroot) | |
| 1124 | |
| 1075 | 1125 |
| 1076 def main(): | 1126 def main(): |
| 1077 """ | 1127 """ |
| 1078 This is a Galaxy wrapper. | 1128 This is a Galaxy wrapper. |
| 1079 It expects to be called by a special purpose tool.xml | 1129 It expects to be called by a special purpose tool.xml |
