comparison rgToolFactory.py @ 18:a986c9f88d38 draft

removed dependencies
author fubar
date Sun, 23 Mar 2014 07:28:32 -0400
parents 903e3748f735
children 4bfe405f76ed
comparison
equal deleted inserted replaced
17:903e3748f735 18:a986c9f88d38
6 # all rights reserved 6 # all rights reserved
7 # Licensed under the LGPL 7 # Licensed under the LGPL
8 # suggestions for improvement and bug fixes welcome at https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home 8 # suggestions for improvement and bug fixes welcome at https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
9 # 9 #
10 # march 2014 10 # march 2014
11 # had to remove dependencies because cross toolshed dependencies are not possible - can't pre-specify a toolshed url for graphicsmagick and ghostscript
12 # grrrrr - night before a demo
11 # added dependencies to a tool_dependencies.xml if html page generated so generated tool is properly portable 13 # added dependencies to a tool_dependencies.xml if html page generated so generated tool is properly portable
12 # 14 #
13 # added ghostscript and graphicsmagick as dependencies 15 # added ghostscript and graphicsmagick as dependencies
14 # fixed a wierd problem where gs was trying to use the new_files_path from universe (database/tmp) as ./database/tmp 16 # fixed a wierd problem where gs was trying to use the new_files_path from universe (database/tmp) as ./database/tmp
15 # errors ensued 17 # errors ensued
93 # if we do html we need these dependencies specified in a tool_dependencies.xml file and referred to in the generated 95 # if we do html we need these dependencies specified in a tool_dependencies.xml file and referred to in the generated
94 # tool xml 96 # tool xml
95 toolhtmldepskel = """<?xml version="1.0"?> 97 toolhtmldepskel = """<?xml version="1.0"?>
96 <tool_dependency> 98 <tool_dependency>
97 <package name="ghostscript" version="9.10"> 99 <package name="ghostscript" version="9.10">
98 <repository name="package_ghostscript_9_10" owner="devteam" prior_installation_required="True" toolshed="http://toolshed.g2.bx.psu.edu/" /> 100 <repository name="package_ghostscript_9_10" owner="devteam" prior_installation_required="True" />
99 </package> 101 </package>
100 <package name="graphicsmagick" version="1.3.18"> 102 <package name="graphicsmagick" version="1.3.18">
101 <repository name="package_graphicsmagick_1_3" owner="iuc" prior_installation_required="True" toolshed="http://toolshed.g2.bx.psu.edu/" /> 103 <repository name="package_graphicsmagick_1_3" owner="iuc" prior_installation_required="True" />
102 </package> 104 </package>
103 <readme> 105 <readme>
104 %s 106 %s
105 </readme> 107 </readme>
106 </tool_dependency> 108 </tool_dependency>
360 if self.opts.make_HTML: 362 if self.opts.make_HTML:
361 if self.opts.help_text: 363 if self.opts.help_text:
362 hlp = open(self.opts.help_text,'r').read() 364 hlp = open(self.opts.help_text,'r').read()
363 else: 365 else:
364 hlp = 'Please ask the tool author for help as none was supplied at tool generation\n' 366 hlp = 'Please ask the tool author for help as none was supplied at tool generation\n'
365 tooldepcontent = toolhtmldepskel % hlp 367 if self.opts.include_dependencies:
366 depf = open(os.path.join(tdir,'tool_dependencies.xml'),'w') 368 tooldepcontent = toolhtmldepskel % hlp
367 depf.write(tooldepcontent) 369 depf = open(os.path.join(tdir,'tool_dependencies.xml'),'w')
368 depf.write('\n') 370 depf.write(tooldepcontent)
369 depf.close() 371 depf.write('\n')
372 depf.close()
370 if self.opts.input_tab <> 'None': # no reproducible test otherwise? TODO: maybe.. 373 if self.opts.input_tab <> 'None': # no reproducible test otherwise? TODO: maybe..
371 testdir = os.path.join(tdir,'test-data') 374 testdir = os.path.join(tdir,'test-data')
372 os.mkdir(testdir) # make tests directory 375 os.mkdir(testdir) # make tests directory
373 shutil.copyfile(self.opts.input_tab,os.path.join(testdir,self.test1Input)) 376 shutil.copyfile(self.opts.input_tab,os.path.join(testdir,self.test1Input))
374 if self.opts.output_tab <> 'None': 377 if self.opts.output_tab <> 'None':
651 a('--make_HTML',default=None) 654 a('--make_HTML',default=None)
652 a('--help_text',default=None) 655 a('--help_text',default=None)
653 a('--tool_desc',default=None) 656 a('--tool_desc',default=None)
654 a('--new_tool',default=None) 657 a('--new_tool',default=None)
655 a('--tool_version',default=None) 658 a('--tool_version',default=None)
659 a('--include_dependencies',default=None)
656 opts, args = op.parse_args() 660 opts, args = op.parse_args()
657 assert not opts.bad_user,'UNAUTHORISED: %s is NOT authorized to use this tool until Galaxy admin adds %s to admin_users in universe_wsgi.ini' % (opts.bad_user,opts.bad_user) 661 assert not opts.bad_user,'UNAUTHORISED: %s is NOT authorized to use this tool until Galaxy admin adds %s to admin_users in universe_wsgi.ini' % (opts.bad_user,opts.bad_user)
658 assert opts.tool_name,'## Tool Factory expects a tool name - eg --tool_name=DESeq' 662 assert opts.tool_name,'## Tool Factory expects a tool name - eg --tool_name=DESeq'
659 assert opts.interpreter,'## Tool Factory wrapper expects an interpreter - eg --interpreter=Rscript' 663 assert opts.interpreter,'## Tool Factory wrapper expects an interpreter - eg --interpreter=Rscript'
660 assert os.path.isfile(opts.script_path),'## Tool Factory wrapper expects a script path - eg --script_path=foo.R' 664 assert os.path.isfile(opts.script_path),'## Tool Factory wrapper expects a script path - eg --script_path=foo.R'