diff toolfactory/rgToolFactory2.py @ 46:f8700bed1e17 draft

Uploaded
author fubar
date Tue, 18 Aug 2020 08:25:43 -0400
parents e7e9732ebed6
children
line wrap: on
line diff
--- a/toolfactory/rgToolFactory2.py	Sun Aug 16 20:05:19 2020 -0400
+++ b/toolfactory/rgToolFactory2.py	Tue Aug 18 08:25:43 2020 -0400
@@ -173,10 +173,17 @@
         self.testparam = []
         if (
             self.args.runmode == "Executable" or self.args.runmode == "system"
-        ):  # binary - no need
-            aCL(self.args.exe_package)  # this little CL will just run
+        ): 
+            if len(self.args.cl_override) > 0:
+                for x in self.args.cl_override.split(' '):
+                    aCL(x)
+            else:
+                aCL(self.args.exe_package)  # this little CL will just run
         else:
             self.prepScript()
+            aCL(self.args.interpreter_name)
+            aCL(self.sfile)
+
         self.elog = "%s_error_log.txt" % self.tool_name
         self.tlog = "%s_runner_log.txt" % self.tool_name
 
@@ -231,7 +238,6 @@
                 self.clargparse()
 
     def prepScript(self):
-        aCL = self.cl.append
         rx = open(self.args.script_path, "r").readlines()
         rx = [x.rstrip() for x in rx]
         rxcheck = [x.strip() for x in rx if x.strip() > ""]
@@ -255,9 +261,9 @@
             artifact.write(bytes("#!/usr/bin/env python\n", "utf8"))
         artifact.write(bytes(self.script, "utf8"))
         artifact.close()
-        aCL(self.args.interpreter_name)
-        aCL(self.sfile)
-
+        
+        
+        
     def cleanuppar(self):
         """ positional parameters are complicated by their numeric ordinal"""
         for i, p in enumerate(self.infiles):
@@ -482,7 +488,10 @@
         Uses galaxyhtml
         Hmmm. How to get the command line into correct order...
         """
-        self.tool.command_line_override = self.xmlcl
+        if self.args.cl_override:
+            self.tool.command_line_override = self.args.cl_override.split(' ') + self.xmlcl
+        else:
+            self.tool.command_line_override = self.xmlcl
         if self.args.interpreter_name:
             self.tool.interpreter = self.args.interpreter_name
         if self.args.help_text:
@@ -499,6 +508,13 @@
         requirements = gxtp.Requirements()
 
         if self.args.interpreter_name:
+            if self.args.dependencies:
+                for d in self.args.dependencies.split(','):
+                    requirements.append(
+                        gxtp.Requirement(
+                         "package", d, ""
+                        )
+                    )
             if self.args.interpreter_name == "python":
                 requirements.append(
                     gxtp.Requirement(
@@ -691,6 +707,8 @@
     parser = argparse.ArgumentParser()
     a = parser.add_argument
     a("--script_path", default="")
+    a("--dependencies", default="")
+    a("--cl_override", default="")
     a("--tool_name", default=None)
     a("--interpreter_name", default=None)
     a("--interpreter_version", default=None)