# HG changeset patch
# User fubar
# Date 1395309038 14400
# Node ID 704ccaade924f0094826b0dab663a28bf68f16e3
# Parent 59bce2efadfe29dfee79930921dfb335d20d0f17
Uploaded
diff -r 59bce2efadfe -r 704ccaade924 rgToolFactory.py
--- a/rgToolFactory.py Thu Mar 20 05:03:17 2014 -0400
+++ b/rgToolFactory.py Thu Mar 20 05:50:38 2014 -0400
@@ -8,6 +8,8 @@
# suggestions for improvement and bug fixes welcome at https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
#
# march 2014
+# added dependencies to a tool_dependencies.xml if html page generated so generated tool is properly portable
+#
# added ghostscript and graphicsmagick as dependencies
# fixed a wierd problem where gs was trying to use the new_files_path from universe (database/tmp) as ./database/tmp
# errors ensued
@@ -88,6 +90,21 @@
debug = False
toolFactoryURL = 'https://bitbucket.org/fubar/galaxytoolfactory'
+# if we do html we need these dependencies
+toolhtmldep = """
+
+
+
+
+
+
+
+
+ %s
+
+
+"""
+
def timenow():
"""return current time as a string
"""
@@ -130,7 +147,7 @@
self.toolname = re.sub('[^a-zA-Z0-9_]+', '', opts.tool_name) # a sanitizer now does this but..
self.toolid = self.toolname
self.myname = sys.argv[0] # get our name because we write ourselves out as a tool later
- self.pyfile = self.myname # crude but efficient - the cruft won't hurt much
+ self.pyfile = self.myname # crude but efficient - the cruft won't hurt muchself.tooldepfile)
self.xmlfile = '%s.xml' % self.toolname
s = open(self.opts.script_path,'r').readlines()
s = [x.rstrip() for x in s] # remove pesky dos line endings if needed
@@ -233,7 +250,7 @@
%(help)s
""" # needs a dict with toolname, toolid, interpreter, scriptname, command, inputs as a multi line string ready to write, outputs ditto, help ditto
-
+
newCommand="""
%(toolname)s.py --script_path "$runMe" --interpreter "%(interpreter)s"
--tool_name "%(toolname)s" %(command_inputs)s %(command_outputs)s
@@ -323,9 +340,19 @@
if retval:
print >> sys.stderr,'## Run failed. Cannot build yet. Please fix and retry'
sys.exit(1)
- self.makeXML()
tdir = self.toolname
os.mkdir(tdir)
+ self.makeXML()
+ if self.opts.make_HTML:
+ if self.opts.help_text:
+ hlp = open(self.opts.help_text,'r').read()
+ else:
+ hlp = 'Please ask the tool author for help as none was supplied at tool generation\n'
+ tooldeps = toolhtmldep % hlp
+ depf = open('tool_dependencies.xml','w')
+ depf.write(hlp)
+ depf.write('\n')
+ depf.close()
if self.opts.input_tab <> 'None': # no reproducible test otherwise? TODO: maybe..
testdir = os.path.join(tdir,'test-data')
os.mkdir(testdir) # make tests directory