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

Changeset 106:6de08f44e551 (2020-11-28)
Previous changeset 105:373e1f9cb609 (2020-11-27) Next changeset 107:18e616939a91 (2020-11-28)
Commit message:
Uploaded
modified:
toolfactory/rgToolFactory2.py
b
diff -r 373e1f9cb609 -r 6de08f44e551 toolfactory/rgToolFactory2.py
--- a/toolfactory/rgToolFactory2.py Fri Nov 27 23:17:10 2020 +0000
+++ b/toolfactory/rgToolFactory2.py Sat Nov 28 00:50:29 2020 +0000
[
b'@@ -557,8 +557,10 @@\n                 scrpt.insert(0, "```\\n")\n                 if len(scrpt) > 300:\n                     safertext = (\n-                        safertext + scrpt[:100] + \\\n-                        [">500 lines - stuff deleted", "......"] + scrpt[-100:]\n+                        safertext\n+                        + scrpt[:100]\n+                        + [">500 lines - stuff deleted", "......"]\n+                        + scrpt[-100:]\n                     )\n                 else:\n                     safertext = safertext + scrpt\n@@ -649,7 +651,9 @@\n                     "## Executing Toolfactory generated command line = %s\\n" % scl\n                 )\n             sto.flush()\n-            subp = subprocess.run(self.cl, env=self.ourenv, shell=False, stdout=sto, stderr=ste)\n+            subp = subprocess.run(\n+                self.cl, env=self.ourenv, shell=False, stdout=sto, stderr=ste\n+            )\n             sto.close()\n             ste.close()\n             retval = subp.returncode\n@@ -662,7 +666,9 @@\n                 sto = open(self.outfiles[0][ONAMEPOS], "wb")\n             else:\n                 sto = sys.stdout\n-            subp = subprocess.run(self.cl, env=self.ourenv, shell=False, stdout=sto, stdin=sti)\n+            subp = subprocess.run(\n+                self.cl, env=self.ourenv, shell=False, stdout=sto, stdin=sti\n+            )\n             sto.write("## Executing Toolfactory generated command line = %s\\n" % scl)\n             retval = subp.returncode\n             sto.close()\n@@ -676,42 +682,35 @@\n         logging.debug("run done")\n         return retval\n \n-\n     def copy_to_container(self, src, dest, container):\n-        """ Recreate the src directory tree at dest - full path included\n-        """\n+        """Recreate the src directory tree at dest - full path included"""\n         idir = os.getcwd()\n         workdir = os.path.dirname(src)\n         os.chdir(workdir)\n         _, tfname = tempfile.mkstemp(suffix=".tar")\n-        tar = tarfile.open(tfname, mode=\'w\')\n+        tar = tarfile.open(tfname, mode="w")\n         srcb = os.path.basename(src)\n         tar.add(srcb)\n         tar.close()\n-        data = open(tfname, \'rb\').read()\n+        data = open(tfname, "rb").read()\n         container.put_archive(dest, data)\n         os.unlink(tfname)\n         os.chdir(idir)\n \n-\n     def copy_from_container(self, src, dest, container):\n-        """ recreate the src directory tree at dest using docker sdk\n-        """\n-        os.makedirs(dest,exist_ok=True)\n+        """recreate the src directory tree at dest using docker sdk"""\n+        os.makedirs(dest, exist_ok=True)\n         _, tfname = tempfile.mkstemp(suffix=".tar")\n-        tf = open(tfname,\'wb\')\n+        tf = open(tfname, "wb")\n         bits, stat = container.get_archive(src)\n         for chunk in bits:\n             tf.write(chunk)\n         tf.close()\n-        tar = tarfile.open(tfname,\'r\')\n+        tar = tarfile.open(tfname, "r")\n         tar.extractall(dest)\n         tar.close()\n         os.unlink(tfname)\n \n-\n-\n-\n     def planemo_biodocker_test(self):\n         """planemo currently leaks dependencies if used in the same container and gets unhappy after a\n         first successful run. https://github.com/galaxyproject/planemo/issues/1078#issuecomment-731476930\n@@ -720,13 +719,14 @@\n \n \n         """\n-        def prun(container,tout,cl,user="biodocker"):\n-            rlog = container.exec_run(cl,user=user)\n-            slogl = str(rlog).split(\'\\\\n\')\n-            slog = \'\\n\'.join(slogl)\n+\n+        def prun(container, tout, cl, user="biodocker"):\n+            rlog = container.exec_run(cl, user=user)\n+            slogl = str(rlog).split("\\\\n")\n+            slog = "\\n".join(slogl)\n             tout.write(f"## got rlog {slog} from {cl}\\n")\n \n-        dgroup = grp.getgrnam(\'docker\')[2]\n+        dgroup = grp.getgrnam("docker")[2]\n         if os.path.exists(self.tlog):\n             tout = open(self.tlog, "a")\n         else:\n@@ -734,25 +734,30 @@\n         planemoimage '..b'   "test",\n-                "--test_data", os.path.self.testdir,\n-                "--test_output", os.path.tool_test_path,\n+                "--test_data",\n+                os.path.self.testdir,\n+                "--test_output",\n+                os.path.tool_test_path,\n                 "--skip_venv",\n                 "--galaxy_root",\n                 self.args.galaxy_root,\n                 xreal,\n             ]\n             subp = subprocess.run(\n-                cll, env=self.ourenv, shell=False, cwd=self.tooloutdir, stderr=tout, stdout=tout\n+                cll,\n+                env=self.ourenv,\n+                shell=False,\n+                cwd=self.tooloutdir,\n+                stderr=tout,\n+                stdout=tout,\n             )\n         tout.close()\n         return subp.returncode\n \n-\n     def writeShedyml(self):\n         """for planemo"""\n         yuser = self.args.user_email.split("@")[0]\n@@ -1094,17 +1137,13 @@\n \n         def exclude_function(tarinfo):\n             filename = tarinfo.name\n-            return (\n-                None\n-                if filename.endswith(excludeme)\n-                else tarinfo\n-            )\n+            return None if filename.endswith(excludeme) else tarinfo\n \n         for p in self.outfiles:\n             oname = p[ONAMEPOS]\n             tdest = os.path.join(self.testdir, "%s_sample" % oname)\n             if not os.path.isfile(tdest):\n-                src = os.path.join(self.testdir,oname)\n+                src = os.path.join(self.testdir, oname)\n                 if os.path.isfile(src):\n                     shutil.copyfile(src, tdest)\n                     dest = os.path.join(self.repdir, "%s.sample" % (oname))\n@@ -1127,8 +1166,8 @@\n                     continue\n                 if "." in entry.name:\n                     nayme, ext = os.path.splitext(entry.name)\n-                    if ext in [\'.yml\',\'.xml\',\'.json\',\'.yaml\']:\n-                        ext = f\'{ext}.txt\'\n+                    if ext in [".yml", ".xml", ".json", ".yaml"]:\n+                        ext = f"{ext}.txt"\n                 else:\n                     ext = ".txt"\n                 ofn = "%s%s" % (entry.name.replace(".", "_"), ext)\n@@ -1137,7 +1176,11 @@\n                 shutil.copyfile(src, dest)\n         with os.scandir(self.testdir) as outs:\n             for entry in outs:\n-                if (not entry.is_file()) or entry.name.endswith(\'_sample\') or entry.name.endswith("_planemo_test_report.html"):\n+                if (\n+                    (not entry.is_file())\n+                    or entry.name.endswith("_sample")\n+                    or entry.name.endswith("_planemo_test_report.html")\n+                ):\n                     continue\n                 if "." in entry.name:\n                     nayme, ext = os.path.splitext(entry.name)\n@@ -1149,7 +1192,6 @@\n                 shutil.copyfile(src, dest)\n \n \n-\n def main():\n     """\n     This is a Galaxy wrapper. It expects to be called by a special purpose tool.xml as:\n@@ -1183,8 +1225,7 @@\n     a("--tfout", default="./tfout")\n     a("--new_tool", default="new_tool")\n     a("--galaxy_url", default="http://localhost:8080")\n-    a(\n-        "--toolshed_url", default="http://localhost:9009")\n+    a("--toolshed_url", default="http://localhost:9009")\n     # make sure this is identical to tool_sheds_conf.xml  localhost != 127.0.0.1 so validation fails\n     a("--toolshed_api_key", default="fakekey")\n     a("--galaxy_api_key", default="fakekey")\n@@ -1207,11 +1248,11 @@\n     r.writeShedyml()\n     r.makeTool()\n     if args.make_Tool == "generate":\n-        retcode = r.run() # for testing toolfactory itself\n+        retcode = r.run()  # for testing toolfactory itself\n         r.moveRunOutputs()\n         r.makeToolTar()\n     else:\n-        r.planemo_biodocker_test() # test to make outputs and then test\n+        r.planemo_biodocker_test()  # test to make outputs and then test\n         r.moveRunOutputs()\n         r.makeToolTar()\n         if args.make_Tool == "gentestinstall":\n'