Mercurial > repos > fubar > tool_factory_2
comparison toolfactory/rgToolFactory2.py @ 147:4e83512cb72c draft
Uploaded
author | fubar |
---|---|
date | Sun, 18 Apr 2021 07:59:23 +0000 |
parents | 351d479e4a86 |
children | 470d3e309508 |
comparison
equal
deleted
inserted
replaced
146:2961862e2236 | 147:4e83512cb72c |
---|---|
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 # ourdir = os.getcwd() | |
1048 # print('########## ourdir=',ourdir,'gr=',self.args.galaxy_root) | |
1049 # pconfig = os.path.join(ourdir,'planemo', '.planemo.yml') | |
1050 # penv["PLANEMO_GLOBAL_CONFIG_PATH"] = pconfig | |
1051 # penv["HOME"] = ourdir | |
1052 # # self.set_planemo_galaxy_root(self.args.galaxy_root, config_path=pconfig) | |
1046 xreal = "%s.xml" % self.tool_name | 1053 xreal = "%s.xml" % self.tool_name |
1047 tool_test_path = os.path.join( | 1054 tool_test_path = os.path.join( |
1048 self.repdir, f"{self.tool_name}_planemo_test_report.html" | 1055 self.repdir, f"{self.tool_name}_planemo_test_report.html" |
1049 ) | 1056 ) |
1050 if os.path.exists(self.tlog): | 1057 if os.path.exists(self.tlog): |
1052 else: | 1059 else: |
1053 tout = open(self.tlog, "w") | 1060 tout = open(self.tlog, "w") |
1054 cll = [ | 1061 cll = [ |
1055 "planemo", | 1062 "planemo", |
1056 "test", | 1063 "test", |
1064 "--galaxy_python_version", | |
1065 self.args.python_version, | |
1057 "--test_data", | 1066 "--test_data", |
1058 os.path.abspath(self.testdir), | 1067 os.path.abspath(self.testdir), |
1059 "--test_output", | 1068 "--test_output", |
1060 os.path.abspath(tool_test_path), | 1069 os.path.abspath(tool_test_path), |
1061 "--galaxy_root", | 1070 "--galaxy_root", |
1064 os.path.abspath(xreal), | 1073 os.path.abspath(xreal), |
1065 ] | 1074 ] |
1066 p = subprocess.run( | 1075 p = subprocess.run( |
1067 cll, | 1076 cll, |
1068 shell=False, | 1077 shell=False, |
1078 env=penv, | |
1069 cwd=self.tooloutdir, | 1079 cwd=self.tooloutdir, |
1070 stderr=tout, | 1080 stderr=tout, |
1071 stdout=tout, | 1081 stdout=tout, |
1072 ) | 1082 ) |
1073 tout.close() | 1083 tout.close() |
1074 return p.returncode | 1084 return p.returncode |
1085 | |
1086 def set_planemo_galaxy_root(self, galaxyroot, config_path=".planemo.yml"): | |
1087 # planemo tries to write to ~/.planemo - trying to convince it otherwise | |
1088 CONFIG_TEMPLATE = """## Planemo Global Configuration File. | |
1089 ## Everything in this file is completely optional - these values can all be | |
1090 ## configured via command line options for the corresponding commands. | |
1091 ## Specify a default galaxy_root for test and server commands here. | |
1092 galaxy_root: %s | |
1093 ## Username used with toolshed(s). | |
1094 #shed_username: "<TODO>" | |
1095 sheds: | |
1096 # For each tool shed you wish to target, uncomment key or both email and | |
1097 # password. | |
1098 toolshed: | |
1099 #key: "<TODO>" | |
1100 #email: "<TODO>" | |
1101 #password: "<TODO>" | |
1102 testtoolshed: | |
1103 #key: "<TODO>" | |
1104 #email: "<TODO>" | |
1105 #password: "<TODO>" | |
1106 local: | |
1107 #key: "<TODO>" | |
1108 #email: "<TODO>" | |
1109 #password: "<TODO>" | |
1110 """ | |
1111 if not os.path.exists(config_path): | |
1112 with open(config_path, "w") as f: | |
1113 f.write(CONFIG_TEMPLATE % galaxyroot) | |
1114 | |
1115 | |
1075 | 1116 |
1076 def main(): | 1117 def main(): |
1077 """ | 1118 """ |
1078 This is a Galaxy wrapper. | 1119 This is a Galaxy wrapper. |
1079 It expects to be called by a special purpose tool.xml | 1120 It expects to be called by a special purpose tool.xml |