Mercurial > repos > fubar > tool_factory_2
changeset 80:f423a77bc669 draft
Uploaded
author | fubar |
---|---|
date | Tue, 17 Nov 2020 09:04:25 +0000 |
parents | 2d0272e730d1 |
children | 6395be766c2e |
files | toolfactory/rgToolFactory2.py |
diffstat | 1 files changed, 32 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/toolfactory/rgToolFactory2.py Tue Nov 17 06:21:07 2020 +0000 +++ b/toolfactory/rgToolFactory2.py Tue Nov 17 09:04:25 2020 +0000 @@ -689,7 +689,7 @@ repos = ts.repositories.get_repositories() rnames = [x.get("name", "?") for x in repos] rids = [x.get("id", "?") for x in repos] - sto.write(f"############names={rnames} rids={rids}") + sto.write(f"############names={rnames} rids={rids}\n") cat = "ToolFactory generated tools" if self.args.tool_name not in rnames: tscat = ts.categories.get_categories() @@ -709,14 +709,14 @@ category_ids=catID, ) tid = res.get("id", None) - sto.write(f"##########create res={res}") + sto.write(f"##########create res={res}\n") else: i = rnames.index(self.args.tool_name) tid = rids[i] res = ts.repositories.update_repository( id=tid, tar_ball_path=self.newtarpath, commit_message=None ) - sto.write(f"#####update res={res}") + sto.write(f"#####update res={res}\n") sto.close() def eph_galaxy_load(self): @@ -774,7 +774,6 @@ repos = ts.repositories.get_repositories() rnames = [x.get("name", "?") for x in repos] rids = [x.get("id", "?") for x in repos] - tout.write(f"############names={rnames} rids={rids}") #cat = "ToolFactory generated tools" if self.args.tool_name not in rnames: cll = [ @@ -796,9 +795,9 @@ except: pass if p.returncode != 0: - tout.write("Repository %s exists" % self.args.tool_name) + tout.write("Repository %s exists\n" % self.args.tool_name) else: - tout.write("initiated %s" % self.args.tool_name) + tout.write("initiated %s\n" % self.args.tool_name) cll = [ "planemo", "shed_upload", @@ -814,7 +813,7 @@ self.newtarpath, ] p = subprocess.run(cll, shell=False, stdout=tout, stderr=tout) - tout.write("Ran %s got %d" % (" ".join(cll), p.returncode)) + tout.write("Ran %s got %d\n" % (" ".join(cll), p.returncode)) tout.close() return p.returncode @@ -892,7 +891,6 @@ cll = [ "planemo", "test", - "--test_output_xunit",os.path.join(self.repdir,f"{self.tool_name}_xunit.xml") "--test_data", os.path.abspath(self.testdir), "--test_output", os.path.abspath(tool_test_path), "--galaxy_root", @@ -904,15 +902,16 @@ cll, shell=False, cwd=self.tooloutdir, - stderr=tout, - stdout=tout, + stderr=dummy, + stdout=dummy, ) + else: cll = [ "planemo", "test", - "--test_data", self.testdir, - "--test_output", tool_test_path, + "--test_data", os.path.abspath(self.testdir), + "--test_output", os.path.abspath(tool_test_path), "--galaxy_root", self.args.galaxy_root, os.path.abspath(xreal), @@ -953,8 +952,6 @@ pth = p[IPATHPOS] dest = os.path.join(self.testdir, "%s_sample" % p[ICLPOS]) shutil.copyfile(pth, dest) - dest = os.path.join(self.repdir, "%s.%s" % (p[ICLPOS], p[IFMTPOS])) - shutil.copyfile(pth, dest) def makeToolTar(self): """move outputs into test-data and prepare the tarball""" @@ -964,8 +961,7 @@ filename = tarinfo.name return ( None - if filename.startswith(excludeme) or \ - os.path.splitext(filename)[1].startswith(excludeme) + if filename.startswith(excludeme) else tarinfo ) @@ -990,15 +986,29 @@ """need to move planemo or run outputs into toolfactory collection""" with os.scandir(self.tooloutdir) as outs: for entry in outs: - if not entry.is_file() or entry.name.startswith("."): + if not entry.is_file(): + continue + if "." in entry.name: + nayme, ext = os.path.splitext(entry.name) + if ext in ['.yml','.xml','.json','.yaml']: + ext = f'{ext}.txt' + else: + ext = ".txt" + ofn = "%s%s" % (entry.name.replace(".", "_"), ext) + dest = os.path.join(self.repdir, ofn) + src = os.path.join(self.tooloutdir, entry.name) + shutil.copyfile(src, dest) + with os.scandir(self.testdir) as outs: + for entry in outs: + if not entry.is_file(): continue if "." in entry.name: nayme, ext = os.path.splitext(entry.name) else: ext = ".txt" - ofn = "%s%s" % (entry.name.replace(".", "_"), ext) - dest = os.path.join(self.repdir, ofn) - src = os.path.join(self.tooloutdir, entry.name) + newname = f"{entry.name}{ext}" + dest = os.path.join(self.repdir, newname) + src = os.path.join(self.testdir, entry.name) shutil.copyfile(src, dest) @@ -1068,8 +1078,10 @@ r.makeToolTar() retcode = r.planemo_test(genoutputs=False) r.moveRunOutputs() + r.makeToolTar() print(f"second planemo_test returned {retcode}") if args.make_Tool == "gentestinstall": + r.shedLoad() r.eph_galaxy_load()