changeset 66:bc1977b1f7b5 draft

Uploaded
author fubar
date Wed, 11 Nov 2020 04:35:24 +0000
parents ed1ecd161295
children 2cb06a59d84b
files toolfactory/rgToolFactory2.py toolfactory/rgToolFactory2.xml
diffstat 2 files changed, 34 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/toolfactory/rgToolFactory2.py	Tue Nov 10 23:53:32 2020 +0000
+++ b/toolfactory/rgToolFactory2.py	Wed Nov 11 04:35:24 2020 +0000
@@ -745,8 +745,8 @@
                   [--homepage_url=<Homepage for tool.>]
                   [--long_description=<long description>]
                   [--category=<category name>]*
-        
-        
+
+
         planemo shed_update --check_diff --shed_target testtoolshed
         """
         if os.path.exists(self.tlog):
@@ -760,7 +760,7 @@
         tout.write(f'############names={rnames} rids={rids}')
         cat = 'ToolFactory generated tools'
         if self.args.tool_name not in rnames:
-            cll = ["planemo", "shed_create", "--shed_target", "local", 
+            cll = ["planemo", "shed_create", "--shed_target", "local",
             "--owner","fubar","--name",
             self.args.tool_name,"--shed_key",
             self.args.toolshed_api_key,]
@@ -838,6 +838,7 @@
                 "--galaxy_root",
                 self.args.galaxy_root,
                 "--update_test_data",
+                "--docker",
                 xreal,
             ]
             p = subprocess.run(
@@ -845,7 +846,7 @@
                 )
         else:
             cll = ["planemo", "test", "--galaxy_root",
-                self.args.galaxy_root,
+                self.args.galaxy_root, "--docker",
                 xreal,]
             p = subprocess.run(
                     cll, shell=False, cwd=self.tooloutdir, stderr=tout, stdout=tout
@@ -893,6 +894,11 @@
     def makeToolTar(self):
         """ move outputs into test-data and prepare the tarball
         """
+        excludeme = "tool_test_output"
+        def exclude_function(tarinfo):
+           filename = tarinfo.name
+           return None if filename.startswith(excludeme)  or os.path.splitext(filename)[1].startswith(excludeme) else tarinfo
+
         for p in self.outfiles:
             src = p[ONAMEPOS]
             if os.path.isfile(src):
@@ -907,7 +913,7 @@
                 )
         self.newtarpath = "toolfactory_%s.tgz" % self.tool_name
         tf = tarfile.open(self.newtarpath, "w:gz")
-        tf.add(name=self.tooloutdir, arcname=self.tool_name)
+        tf.add(name=self.tooloutdir, arcname=self.tool_name, filter=exclude_function)
         tf.close()
         shutil.copyfile(self.newtarpath, self.args.new_tool)
 
@@ -926,8 +932,6 @@
                 dest = os.path.join(self.repdir, ofn)
                 src = os.path.join(self.tooloutdir, entry.name)
                 shutil.copyfile(src, dest)
-                if entry.name.startswith('tool_test_output'):
-                    os.unlink(src)
 
 
 def main():
@@ -987,15 +991,20 @@
     r = ScriptRunner(args)
     r.writeShedyml()
     r.makeTool()
-    retcode = r.planemo_test(genoutputs=True)  # this fails :( - see PR
-    r.moveRunOutputs()
-    r.makeToolTar()
-    retcode = r.planemo_test(genoutputs=False)
-    r.moveRunOutputs()
-    if args.make_Tool == "gentestinstall":
-        retcode = r.planemo_shedload() #r.shedLoad()
-        print(f'planemo_shedload returned {retcode}')
-        r.eph_galaxy_load()
+    if args.make_Tool == "generate":
+        retcode = r.run()
+        r.moveRunOutputs()
+        r.makeToolTar()
+    else:
+        retcode = r.planemo_test(genoutputs=True)  # this fails :( - see PR
+        r.moveRunOutputs()
+        r.makeToolTar()
+        retcode = r.planemo_test(genoutputs=False)
+        r.moveRunOutputs()
+        if args.make_Tool == "gentestinstall":
+            retcode = r.planemo_shedload() #r.shedLoad()
+            print(f'planemo_shedload returned {retcode}')
+            r.eph_galaxy_load()
 
 
 
--- a/toolfactory/rgToolFactory2.xml	Tue Nov 10 23:53:32 2020 +0000
+++ b/toolfactory/rgToolFactory2.xml	Wed Nov 11 04:35:24 2020 +0000
@@ -132,9 +132,9 @@
   </macros>
 
 <requirements>
+       <requirement type="package" version="3.8.5" >python</requirement>
        <requirement type="package" version="0.72.0" >planemo</requirement>
        <requirement type="package" version="0.4.11" >galaxyxml</requirement>
-
 </requirements>
 
   <command ><![CDATA[
@@ -320,9 +320,17 @@
     <conditional name="makeMode">
         <param name="make_Tool" type="select" display="radio" label="Choose the steps you want to run. The TF Docker container is recommended for local installation"
           help="Installation in this Galaxy is optional" >
+        <option value="generate" >Run to generate tests only. Should fail if dependencies needed.</option>
         <option value="gentest" selected="true">Test with planemo after generating.</option>
         <option value="gentestinstall">Install in this Galaxy after generation and testing. Must have local ToolShed as in the TF Docker container</option>
         </param>
+       <when value="generate">
+           <param name="galaxy_apikey" value="" type="hidden"  ></param>
+           <param name="toolshed_apikey" value="" type="hidden"  ></param>
+           <param name="galaxy_url" value="" type="hidden"  ></param>
+           <param name="toolshed_url" value="" type="hidden"  ></param>
+            <expand macro="tool_metadata" />
+        </when>
        <when value="gentest">
            <param name="galaxy_apikey" value="" type="hidden"  ></param>
            <param name="toolshed_apikey" value="" type="hidden"  ></param>