comparison toolfactory/rgToolFactory2.py @ 149:ecd1d283b5a7 draft

Uploaded
author fubar
date Tue, 20 Apr 2021 04:36:02 +0000
parents 470d3e309508
children
comparison
equal deleted inserted replaced
148:470d3e309508 149:ecd1d283b5a7
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 1046 penv = os.environ
1047 # ourdir = os.getcwd() 1047 phome = penv['HOME']
1048 # print('########## ourdir=',ourdir,'gr=',self.args.galaxy_root) 1048 isDocker = os.path.exists('/.dockerenv')
1049 # pconfig = os.path.join(ourdir,'planemo', '.planemo.yml') 1049 if isDocker: # use the volume if it exists
1050 # penv["PLANEMO_GLOBAL_CONFIG_PATH"] = pconfig 1050 phome = '/home/planemo'
1051 # os.mkdir(os.path.join(ourdir,'planemo')) 1051 if os.path.exists(phome): # is mounted
1052 # penv["HOME"] = os.path.join(ourdir,'home') 1052 home = phome
1053 # os.mkdir(os.path.join(ourdir,'home')) 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
1054 # self.set_planemo_galaxy_root(self.args.galaxy_root, config_path=pconfig) 1062 # self.set_planemo_galaxy_root(self.args.galaxy_root, config_path=pconfig)
1055 xreal = "%s.xml" % self.tool_name 1063 xreal = "%s.xml" % self.tool_name
1056 tool_test_path = os.path.join( 1064 tool_test_path = os.path.join(
1057 self.repdir, f"{self.tool_name}_planemo_test_report.html" 1065 self.repdir, f"{self.tool_name}_planemo_test_report.html"
1058 ) 1066 )
1067 self.args.python_version, 1075 self.args.python_version,
1068 "--test_data", 1076 "--test_data",
1069 os.path.abspath(self.testdir), 1077 os.path.abspath(self.testdir),
1070 "--test_output", 1078 "--test_output",
1071 os.path.abspath(tool_test_path), 1079 os.path.abspath(tool_test_path),
1072 "--galaxy_root", 1080 ## "--galaxy_root",
1073 self.args.galaxy_root, 1081 ## self.args.galaxy_root,
1074 "--update_test_data", 1082 "--update_test_data",
1075 os.path.abspath(xreal), 1083 os.path.abspath(xreal),
1076 ] 1084 ]
1077 p = subprocess.run( 1085 p = subprocess.run(
1078 cll, 1086 cll,
1087 env = penv,
1079 shell=False, 1088 shell=False,
1080 env=penv,
1081 cwd=self.tooloutdir, 1089 cwd=self.tooloutdir,
1082 stderr=tout, 1090 stderr=tout,
1083 stdout=tout, 1091 stdout=tout,
1084 ) 1092 )
1085 tout.close() 1093 tout.close()
1111 #password: "<TODO>" 1119 #password: "<TODO>"
1112 """ 1120 """
1113 if not os.path.exists(config_path): 1121 if not os.path.exists(config_path):
1114 with open(config_path, "w") as f: 1122 with open(config_path, "w") as f:
1115 f.write(CONFIG_TEMPLATE % galaxyroot) 1123 f.write(CONFIG_TEMPLATE % galaxyroot)
1116
1117 1124
1118 1125
1119 def main(): 1126 def main():
1120 """ 1127 """
1121 This is a Galaxy wrapper. 1128 This is a Galaxy wrapper.