comparison rgToolFactory.py @ 10:71f2ac0eee95

Updated tarball with some test material - still need code generated... Completed a round trip test via a local toolshed. Awsome
author ross lazarus ross.lazarus@gmail.com
date Sat, 02 Jun 2012 22:40:33 +1000
parents e09c76551bed
children d12728e33c3d
comparison
equal deleted inserted replaced
9:e09c76551bed 10:71f2ac0eee95
1 # rgDynamicScriptWrapper.py 1 # rgToolFactory.py
2 # derived from 2 # derived from
3 # rgBaseScriptWrapper.py 3 # rgBaseScriptWrapper.py
4 # to run some user supplied code 4 # but designed to run arbitrary user supplied code
5 # extremely dangerous 5 # extremely dangerous!!
6 # trusted users only - private site only 6 # trusted users only - private site only
7 # a list in the xml is searched - only users in the list can run this tool. 7 # a list in the xml is searched for users permitted to run this tool.
8 # 8 # DO NOT install on a public or important site - local instance only
9 # generated tools are fine as they just run normally and their user cannot do anything unusually insecure
10 #
9 # copyright ross lazarus (ross.lazarus@gmail.com) May 2012 11 # copyright ross lazarus (ross.lazarus@gmail.com) May 2012
10 # 12 #
11 # all rights reserved 13 # all rights reserved
12 # Licensed under the LGPL for your pleasure 14 # Licensed under the LGPL for your pleasure
13 # Derived from rgDGE.py in May 2012 15 # Derived from rgDGE.py in May 2012
168 print >> sys.stderr,'## Run failed. Cannot build yet. Please fix and retry' 170 print >> sys.stderr,'## Run failed. Cannot build yet. Please fix and retry'
169 sys.exit(1) 171 sys.exit(1)
170 self.makeXML() 172 self.makeXML()
171 tdir = self.toolname 173 tdir = self.toolname
172 os.mkdir(tdir) 174 os.mkdir(tdir)
175 if self.opts.input_tab: # we may have test data?
176 testdir = os.path.join(tdir,'test-data')
177 os.mkdir(testdir) # make tests directory
178 shutil.copyfile(self.opts.input_tab,os.path.join(testdir,'test1_in.tab'))
179 if self.opts.output_tab:
180 shutil.copyfile(self.opts.output_tab,os.path.join(testdir,'test1_out.tab'))
181 if self.opts.make_HTML:
182 shutil.copyfile(self.opts.output_html,os.path.join(testdir,'test1_out.html'))
183 shutil.copyfile(self.opts.tlog,os.path.join(testdir,'test1_out.log'))
173 shutil.copyfile(self.xmlfile,os.path.join(tdir,self.xmlfile)) 184 shutil.copyfile(self.xmlfile,os.path.join(tdir,self.xmlfile))
174 shutil.copyfile(self.pyfile,os.path.join(tdir,'%s.py' % self.toolname)) 185 shutil.copyfile(self.pyfile,os.path.join(tdir,'%s.py' % self.toolname))
175 shutil.copyfile(self.sfile,os.path.join(tdir,self.sfile)) 186 shutil.copyfile(self.sfile,os.path.join(tdir,self.sfile))
176 tarpath = "%s.gz" % self.toolname 187 tarpath = "%s.gz" % self.toolname
177 tar = tarfile.open(tarpath, "w:gz") 188 tar = tarfile.open(tarpath, "w:gz")