diff toolfactory/rgToolFactory2.py @ 149:ecd1d283b5a7 draft

Uploaded
author fubar
date Tue, 20 Apr 2021 04:36:02 +0000
parents 470d3e309508
children
line wrap: on
line diff
--- a/toolfactory/rgToolFactory2.py	Sun Apr 18 08:30:25 2021 +0000
+++ b/toolfactory/rgToolFactory2.py	Tue Apr 20 04:36:02 2021 +0000
@@ -1044,13 +1044,21 @@
         supplied test outputs are sent to repdir for display
         """
         penv = os.environ
-        # ourdir = os.getcwd()
-        # print('########## ourdir=',ourdir,'gr=',self.args.galaxy_root)
-        # pconfig = os.path.join(ourdir,'planemo', '.planemo.yml')
-        # penv["PLANEMO_GLOBAL_CONFIG_PATH"] = pconfig
-        # os.mkdir(os.path.join(ourdir,'planemo'))
-        # penv["HOME"] = os.path.join(ourdir,'home')
-        # os.mkdir(os.path.join(ourdir,'home'))
+        phome = penv['HOME']
+        isDocker = os.path.exists('/.dockerenv')
+        if isDocker: # use the volume if it exists
+            phome = '/home/planemo'
+            if os.path.exists(phome): # is mounted
+                home = phome
+            else:
+                home = '/tmp/planemo' # this will be brutal but otherwise /home/galaxy
+                os.mkdir('/tmp/planemo')
+        penv["HOME"] = phome
+        path = penv['PATH']
+        penv['PATH'] = '%s:%s' % (phome,path)
+        print(f"#### set home to {phome} with path={penv['PATH']}")
+        #pconfig = os.path.join(phome,'.planemo.yml')
+        #penv["PLANEMO_GLOBAL_CONFIG_PATH"] = pconfig
         # self.set_planemo_galaxy_root(self.args.galaxy_root, config_path=pconfig)
         xreal = "%s.xml" % self.tool_name
         tool_test_path = os.path.join(
@@ -1069,15 +1077,15 @@
             os.path.abspath(self.testdir),
             "--test_output",
             os.path.abspath(tool_test_path),
-            "--galaxy_root",
-            self.args.galaxy_root,
+            ## "--galaxy_root",
+            ## self.args.galaxy_root,
             "--update_test_data",
             os.path.abspath(xreal),
         ]
         p = subprocess.run(
             cll,
+            env = penv,
             shell=False,
-            env=penv,
             cwd=self.tooloutdir,
             stderr=tout,
             stdout=tout,
@@ -1115,7 +1123,6 @@
                 f.write(CONFIG_TEMPLATE % galaxyroot)
 
 
-
 def main():
     """
     This is a Galaxy wrapper.