changeset 14:3635f4518c4d draft

Uploaded
author fubar
date Tue, 20 Jan 2015 19:03:18 -0500
parents 00777b83aaca
children dd6cf2ddaac7
files rgToolFactory2.py
diffstat 1 files changed, 28 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/rgToolFactory2.py	Thu Jan 15 07:43:13 2015 -0500
+++ b/rgToolFactory2.py	Tue Jan 20 19:03:18 2015 -0500
@@ -10,7 +10,9 @@
 # January 2015
 # in the process of building a complex tool
 # added ability to choose one of the current toolshed package_r or package_perl or package_python dependencies and source that package
-# need to add that package to tool_dependencies
+# add that package to tool_dependencies
+# Note that once the generated tool is loaded, it will have that package's env.sh loaded automagically so there is no
+# --envshpath in the parameters for the generated tool and it uses the system one which will be first on the adjusted path.
 #
 # sept 2014 added additional params from
 # https://bitbucket.org/mvdbeek/dockertoolfactory/src/d4863bcf7b521532c7e8c61b6333840ba5393f73/DockerToolFactory.py?at=default
@@ -194,6 +196,7 @@
            
                 <readme>
                    %(readme)s
+                   This file was autogenerated by the Galaxy Tool Factory 2
                </readme>
         </tool_dependency>
         """
@@ -208,6 +211,7 @@
             </package>
                 <readme>
                    %(readme)s
+                   This file was autogenerated by the Galaxy Tool Factory 2
                </readme>
         </tool_dependency>
         """
@@ -216,6 +220,7 @@
         <tool_dependency>
                 <readme>
                    %(readme)s
+                This file was autogenerated by the Galaxy Tool Factory 2
                </readme>
         </tool_dependency>
         """
@@ -295,6 +300,8 @@
 
 %(help)s
 
+This tool was autogenerated from a user provided script using the Galaxy Tool Factory 2
+https://toolshed.g2.bx.psu.edu/view/fubar/tool_factory_2
 </help>
 <citations>
     %(citations)s
@@ -427,14 +434,14 @@
         self.interp_revision = None
         self.interp_version = None
         if opts.envshpath <> 'system': # need to parse out details for our tool_dependency
-            try:
+            try: # fragile - depends on common naming convention as at jan 2015 = package_[interp]_v0_v1_v2... = version v0.v1.v2.. is in play
+
                 packdetails = opts.envshpath.split(os.path.sep)[-4:-1]  # eg ['fubar', 'package_r_3_1_1', '63cdb9b2234c']
                 self.interpreter_owner = packdetails[0]
                 self.interpreter_pack = packdetails[1]
                 self.interpreter_name = packdetails[1].split('_')[1].upper()
                 self.interpreter_revision = packdetails[2]
-                self.interpreter_version =  '.'.join(self.interpreter_pack.split('_')[2:])
-                # hope our naming convention as at jan 2015 = package_[interp]_v0_v1_v2... = version v0.v1.v2.. is in play
+                self.interpreter_version =  '.'.join(packdetails[1].split('_')[2:])
             except:
                 pass
         self.outFormats = opts.output_format
@@ -617,7 +624,7 @@
         else:
             hlp = 'Please ask the tool author for help as none was supplied at tool generation\n'
         readme_dict = {'readme':hlp,'interpreter':self.opts.interpreter,'interpreter_version':self.interpreter_version,'interpreter_name':self.interpreter_name,
-        'interpreter_owner':self.interpreter_owner}
+        'interpreter_owner':self.interpreter_owner,'interpreter_pack':self.interpreter_pack}
         if self.opts.include_dependencies == "yes":
             if self.opts.envshpath == 'system':
                 tooldepcontent = self.toolhtmldepskel % readme_dict
@@ -629,23 +636,22 @@
         depf.write(tooldepcontent)
         depf.write('\n')
         depf.close()
-        if self.opts.input_tab: # no reproducible test otherwise? TODO: maybe..
-            testdir = os.path.join(tdir,'test-data')
-            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:
-                    s = si.split(',')[0]
-                    si = s
-                dest = os.path.join(testdir,os.path.basename(si))
-                if si <> dest:
-                    shutil.copyfile(si,dest)
-            if self.opts.output_tab:
-                shutil.copyfile(self.opts.output_tab,os.path.join(testdir,self.test1Output))
-            if self.opts.make_HTML:
-                shutil.copyfile(self.opts.output_html,os.path.join(testdir,self.test1HTML))
-            if self.opts.output_dir:
-                shutil.copyfile(self.tlog,os.path.join(testdir,'test1_out.log'))
+        testdir = os.path.join(tdir,'test-data')
+        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:
+                s = si.split(',')[0]
+                si = s
+            dest = os.path.join(testdir,os.path.basename(si))
+            if si <> dest:
+                shutil.copyfile(si,dest)
+        if self.opts.output_tab:
+            shutil.copyfile(self.opts.output_tab,os.path.join(testdir,self.test1Output))
+        if self.opts.make_HTML:
+            shutil.copyfile(self.opts.output_html,os.path.join(testdir,self.test1HTML))
+        if self.opts.output_dir:
+            shutil.copyfile(self.tlog,os.path.join(testdir,'test1_out.log'))
         outpif = '%s.py' % self.toolname # new name
         outpiname = os.path.join(tdir,outpif) # path for the tool tarball
         pyin = os.path.basename(self.pyfile) # our name - we rewrite ourselves (TM)