Repository 'tool_factory_2'
hg clone https://toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_2

Changeset 111:223b78754735 (2020-11-29)
Previous changeset 110:ab2474035f81 (2020-11-29) Next changeset 112:5509dc4c1cf2 (2020-11-29)
Commit message:
Uploaded
modified:
toolfactory/rgToolFactory2.py
toolfactory/rgToolFactory2.xml
b
diff -r ab2474035f81 -r 223b78754735 toolfactory/rgToolFactory2.py
--- a/toolfactory/rgToolFactory2.py Sun Nov 29 06:16:34 2020 +0000
+++ b/toolfactory/rgToolFactory2.py Sun Nov 29 07:51:53 2020 +0000
[
@@ -63,8 +63,8 @@
 <exit_code range="100:" level="debug" description="shite happens" />
 </stdio>"""
 
-# --input_files="$input_files~~~$CL~~~$input_formats~~~$input_label
-# ~~~$input_help"
+# --input_files="$intab.input_files~~~$intab.input_CL~~~$intab.input_formats\
+#~~~$intab.input_label~~~$intab.input_help"
 IPATHPOS = 0
 ICLPOS = 1
 IFMTPOS = 2
@@ -263,7 +263,7 @@
                 clsuffix.append(appendme)
                 xclsuffix.append(xappendme)
             for i, p in enumerate(self.outfiles):
-                if p[OOCLPOS] == "STDOUT":
+                if p[OCLPOS] == "STDOUT":
                     self.lastclredirect = [">", p[ONAMEPOS]]
                     self.lastxclredirect = [">", "$%s" % p[OCLPOS]]
                 else:
@@ -296,7 +296,7 @@
         tscript.write(self.script)
         tscript.close()
         self.escapedScript = [cheetah_escape(x) for x in rx]
-        self.spacedScript = [f"    {x}" for x in self.escapedScript]
+        self.spacedScript = [f"    {x}" for x in rx]
         art = "%s.%s" % (self.tool_name, self.executeme)
         artifact = open(art, "wb")
         artifact.write(bytes('\n'.join(self.escapedScript),'utf8'))
@@ -305,21 +305,23 @@
     def cleanuppar(self):
         """ positional parameters are complicated by their numeric ordinal"""
         for i, p in enumerate(self.infiles):
+            infp = copy.copy(p)
             if self.args.parampass == "positional":
-                assert p[
+                assert infp[
                     ICLPOS
                 ].isdigit(), "Positional parameters must be ordinal integers - got %s for %s" % (
-                    p[ICLPOS],
-                    p[ILABPOS],
+                    infp[ICLPOS],
+                    infp[ILABPOS],
                 )
-            p.append(p[ICLPOS])
-            if p[ICLPOS].isdigit() or self.args.parampass == "0":
+            icl = infp[ICLPOS]
+            infp.append(icl)
+            if infp[ICLPOS].isdigit() or self.args.parampass == "0":
                 scl = "input%d" % (i + 1)
-                p[ICLPOS] = scl
-            self.infiles[i] = p
+                infp[ICLPOS] = scl
+            self.infiles[i] = infp
         for i, p in enumerate(
             self.outfiles
-        ):  # trying to automagically gather using extensions
+        ):
             if self.args.parampass == "positional" and p[OCLPOS] != "STDOUT":
                 assert p[
                     OCLPOS
@@ -327,7 +329,7 @@
                     p[OCLPOS],
                     p[ONAMEPOS],
                 )
-            p.append(p[OCLPOS])
+            p.append(p[OCLPOS]) # keep copy
             if p[OCLPOS].isdigit() or p[OCLPOS] == "STDOUT":
                 scl = p[ONAMEPOS]
                 p[OCLPOS] = scl
@@ -412,19 +414,19 @@
 
     def doXMLparam(self):
         """flake8 made me do this..."""
-        for p in self.outfiles:
+        for p in self.outfiles: # --output_files "$otab.history_name~~~$otab.history_format~~~$otab.history_CL~~~$otab.history_test"
             newname, newfmt, newcl, test, oldcl = p
             test = test.strip()
             ndash = self.getNdash(newcl)
-            aparm = gxtp.OutputData(newcl, format=newfmt, num_dashes=ndash)
+            aparm = gxtp.OutputData(name=newname, format=newfmt, num_dashes=ndash, label=newcl)
             aparm.positional = self.is_positional
             if self.is_positional:
                 if oldcl == "STDOUT":
                     aparm.positional = 9999999
-                    aparm.command_line_override = "> $%s" % newcl
+                    aparm.command_line_override = "> $%s" % newname
                 else:
                     aparm.positional = int(oldcl)
-                    aparm.command_line_override = "$%s" % newcl
+                    aparm.command_line_override = "$%s" % newname
             self.toutputs.append(aparm)
             ld = None
             if test.strip() > "":
@@ -582,7 +584,7 @@
                         + [">300 lines - stuff deleted", "......"]
                         + scr[-100:]
                     )
-                scr.append('\n------\n')
+                scr.append('\n')
                 safertext = safertext + "\n".join(scr)
             self.newtool.help = safertext
         else:
@@ -843,6 +845,7 @@
                 category_ids=catID,
             )
             tid = res.get("id", None)
+            sto.write(f"#####create_repository {self.args.tool_name} tid={tid} res={res}\n")
         else:
             i = rnames.index(self.tool_name)
             tid = rids[i]
@@ -850,10 +853,10 @@
             res = ts.repositories.update_repository(
                 id=tid, tar_ball_path=self.newtarpath, commit_message=None
             )
-            sto.write(f"#####update res={res}\n")
+            sto.write(f"#####update res id {id} ={res}\n")
         except ConnectionError:
             sto.write(
-                "Probably no change to repository - bioblend shed upload failed\n"
+                "Is the toolshed running and the API key correct? Bioblend shed upload failed\n"
             )
         sto.close()
 
b
diff -r ab2474035f81 -r 223b78754735 toolfactory/rgToolFactory2.xml
--- a/toolfactory/rgToolFactory2.xml Sun Nov 29 06:16:34 2020 +0000
+++ b/toolfactory/rgToolFactory2.xml Sun Nov 29 07:51:53 2020 +0000
[
@@ -69,15 +69,15 @@
         </repeat>
         <repeat name="history_outputs" title="Add a tool run output file to the user's history from your tool - Use the '+' button to add as many as needed"
              help="The name will become a history item for users of the new tool you are making containing one of it's outputs">
-            <param name="history_name" type="text" label="Name for this output to appear in new history" optional="false" help=""/>
+            <param name="history_name" type="text" label="Name for this output to appear in new history" optional="false" help="Argparse will also use this name as --[name]"/>
             <param name="history_format" type="select" multiple="false" label="Select the datatype for this output"
               help="If your datatype is not listed here, it has to be added in galaxy's datatypes_conf.xml" value="tabular">
                <options from_parameter="tool.app.datatypes_registry.upload_file_formats">
                 <column name="value" index="0"/>
                </options>
             </param>
-            <param name="history_CL" type="text"  label="Positional: ordinal integer. Argparse: argument name expected for this output parameter. Use STDOUT if '>' required."
-              help="If positional parameters, enter the integer ordinal expected for this parameter. If Argparse style, '--' will be prepended or '-' if single character" value=""/>
+            <param name="history_CL" type="text"  label="Positional: ordinal integer. Use STDOUT if '>' required. Otherwise ignored if argparse because name is used"
+              help="If positional parameters, enter the integer ordinal expected for this parameter. If argparse, ignore unless STDOUT needed" value=""/>
             <param name="history_test" type="text"  label="Test pass decision criterion for this output compared to test generation"
               help="Available options are diff:[lines], sim_size:[delta (integer) or delta_frac (float)" value="sim_size:0.01"/>
         </repeat>