Permalink
Browse files

Tiny backward compatible Python 3 tweaks for planemo_ext/tool_factory_2/

  • Loading branch information...
peterjc committed Sep 25, 2015
1 parent 65de593 commit dad2d9d3c3a5f20c7f59c05317d157a6357c8a8b
Showing with 13 additions and 13 deletions.
  1. +3 −3 planemo_ext/tool_factory_2/getlocalrpackages.py
  2. +10 −10 planemo_ext/tool_factory_2/rgToolFactory2.py
@@ -12,7 +12,7 @@ def find_packages(prefix="package_r_"):
#/data/home/rlazarus/galaxy/tool_dependency_dir/R_3_1_1/3.1.1/fubar/package_r_3_1_1/d9964efbfbe3/env.sh
#/data/home/rlazarus/galtest/tool_dependency_dir/R_3_1_1/3.1.1/fubar/package_r_3_1_1/63cdb9b2234c/env.sh
eprefix = prefix
if prefix.find('/') <> -1:
if prefix.find('/') != -1:
eprefix = prefix.replace('/','\/') # for grep
path = '.'
# fails on nitesh's recent mac - locate not working
@@ -48,5 +48,5 @@ def testapi():


if __name__ == "__main__":
print find_packages()
print(find_packages())

@@ -358,7 +358,7 @@ def __init__(self,opts=None):
if opts.input_tab:
tests = []
for i,intab in enumerate(opts.input_tab): # if multiple, make tests
if intab.find(',') <> -1:
if intab.find(',') != -1:
(gpath,uname) = intab.split(',')
else:
gpath = uname = intab
@@ -436,7 +436,7 @@ def __init__(self,opts=None):
self.interpreter_name = 'SYSTEM'
self.interpreter_version = 'SYSTEM'
self.interpreter_revision = 'SYSTEM'
if opts.envshpath <> 'system': # need to parse out details for our tool_dependency
if opts.envshpath != 'system': # need to parse out details for our tool_dependency
try: # fragile - depends on common naming convention as at jan 2015 = package_[interp]_v0_v1_v2... = version v0.v1.v2.. is in play
# this ONLY happens at tool generation by an admin - the generated tool always uses the default of system so path is from local env.sh
packdetails = opts.envshpath.split(os.path.sep)[-4:-1] # eg ['fubar', 'package_r_3_1_1', '63cdb9b2234c']
@@ -518,7 +518,7 @@ def makeXML(self):
xdict['interpreter_name'] = self.interpreter_name
xdict['requirements'] = ''
if self.opts.include_dependencies == "yes":
if self.opts.envshpath <> 'system':
if self.opts.envshpath != 'system':
xdict['requirements'] = self.protorequirements_interpreter % xdict
else:
xdict['requirements'] = self.protorequirements
@@ -643,11 +643,11 @@ def makeTooltar(self):
os.mkdir(testdir) # make tests directory
for i,intab in enumerate(self.opts.input_tab):
si = self.opts.input_tab[i]
if si.find(',') <> -1:
if si.find(',') != -1:
s = si.split(',')[0]
si = s
dest = os.path.join(testdir,os.path.basename(si))
if si <> dest:
if si != dest:
shutil.copyfile(si,dest)
if self.opts.output_tab:
shutil.copyfile(self.opts.output_tab,os.path.join(testdir,self.test1Output))
@@ -765,7 +765,7 @@ def makeHtml(self):
galhtmlpostfix = """</div></body></html>\n"""

flist = os.listdir(self.opts.output_dir)
flist = [x for x in flist if x <> 'Rplots.pdf']
flist = [x for x in flist if x != 'Rplots.pdf']
flist.sort()
html = []
html.append(galhtmlprefix % progname)
@@ -774,7 +774,7 @@ def makeHtml(self):
if len(flist) > 0:
logfiles = [x for x in flist if x.lower().endswith('.log')] # log file names determine sections
logfiles.sort()
logfiles = [x for x in logfiles if os.path.abspath(x) <> os.path.abspath(self.tlog)]
logfiles = [x for x in logfiles if os.path.abspath(x) != os.path.abspath(self.tlog)]
logfiles.append(os.path.abspath(self.tlog)) # make it the last one
pdflist = []
npdf = len([x for x in flist if os.path.splitext(x)[-1].lower() == '.pdf'])
@@ -803,7 +803,7 @@ def makeHtml(self):
realname = os.path.basename(logfname)
sectionname = os.path.splitext(realname)[0].split('_')[0] # break in case _ added to log
ourpdfs = [x for x in pdflist if os.path.basename(x[0]).split('_')[0] == sectionname]
pdflist = [x for x in pdflist if os.path.basename(x[0]).split('_')[0] <> sectionname] # remove
pdflist = [x for x in pdflist if os.path.basename(x[0]).split('_')[0] != sectionname] # remove
nacross = 1
npdf = len(ourpdfs)

@@ -866,7 +866,7 @@ def run(self):
Some devteam tools have this defensive stderr read so I'm keeping with the faith
Feel free to update.
"""
if self.opts.envshpath <> 'system':
if self.opts.envshpath != 'system':
shell_source(self.opts.envshpath)
# this only happens at tool generation - the generated tool relies on the dependencies all being set up
# at toolshed installation by sourcing local env.sh
@@ -895,7 +895,7 @@ def run(self):
p = subprocess.Popen(self.cl,shell=False)
retval = p.wait()
if self.opts.output_dir:
if retval <> 0 and err: # problem
if retval != 0 and err: # problem
print >> sys.stderr,err
if self.opts.make_HTML:
self.makeHtml()

2 comments on commit dad2d9d

@jmchilton

This comment has been minimized.

Copy link
Member

jmchilton replied Sep 25, 2015

You should probably modify this in tools-iuc instead of here I think @peterjc.

@peterjc

This comment has been minimized.

Copy link
Contributor Author

peterjc replied Sep 25, 2015

OK, done: galaxyproject/tools-iuc@f1ddb48

Is there any formal policy on how planemo_etc/* is kept in sync with upstream sources?

Please sign in to comment.