changeset 1:34ff94460cc3 draft

Uploaded
author fubar_too
date Tue, 18 May 2021 11:00:39 +0000
parents 03df06784e56
children cc1a8fbb0f48
files toolfactory/ToolFactory.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/toolfactory/ToolFactory.py	Tue May 18 08:42:29 2021 +0000
+++ b/toolfactory/ToolFactory.py	Tue May 18 11:00:39 2021 +0000
@@ -100,7 +100,7 @@
     """
 
     def __init__(
-        self, args, tool_conf_path, new_tool_archive_path, new_tool_name, local_tool_dir, run_test
+        self, args, tool_conf_path, new_tool_archive_path, new_tool_name, local_tool_dir
     ):
         self.args = args
         self.tool_conf_path = os.path.join(args.galaxy_root, tool_conf_path)
@@ -131,7 +131,12 @@
             shell=False,
         )
 
+
     def update_toolconf(self, ourdir, ourxml):  # path is relative to tools
+
+        def sortchildrenby(parent, attr):
+            parent[:] = sorted(parent, key=lambda child: child.get(attr))
+
         localconf = "./local_tool_conf.xml"
         self.run_rsync(self.tool_conf_path, localconf)
         tree = ET.parse(localconf)
@@ -150,6 +155,7 @@
         for xml in ourxml:  # may be > 1
             if xml not in conf_tools:  # new
                 ET.SubElement(TFsection, "tool", {"file": os.path.join('TFtools', xml)})
+        sortchildrenby(TFsection,"file")
         newconf = f"{self.tool_id}_conf"
         tree.write(newconf, pretty_print=True)
         self.run_rsync(newconf, self.tool_conf_path)
@@ -968,14 +974,13 @@
     r.writeShedyml()
     r.makeTool()
     r.makeToolTar()
-    if args.install == "1":
+    if args.install == "true":
         TCU = Tool_Conf_Updater(
             args=args,
             local_tool_dir=args.local_tools,
             new_tool_archive_path=r.newtarpath,
             tool_conf_path=args.tool_conf_path,
-            new_tool_name=r.tool_name,
-            run_test = args.run_test
+            new_tool_name=r.tool_name
         )
 
 if __name__ == "__main__":