Mercurial > repos > fubar > toolfactory
comparison rgToolFactory.py @ 24:f87139fe5e09 draft
fix for py script parsing
author | fubar |
---|---|
date | Sun, 27 Jul 2014 22:41:41 -0400 |
parents | 2983106e1460 |
children |
comparison
equal
deleted
inserted
replaced
23:8aab0f66cd5f | 24:f87139fe5e09 |
---|---|
157 self.myname = sys.argv[0] # get our name because we write ourselves out as a tool later | 157 self.myname = sys.argv[0] # get our name because we write ourselves out as a tool later |
158 self.pyfile = self.myname # crude but efficient - the cruft won't hurt muchself.tooldepfile) | 158 self.pyfile = self.myname # crude but efficient - the cruft won't hurt muchself.tooldepfile) |
159 self.xmlfile = '%s.xml' % self.toolname | 159 self.xmlfile = '%s.xml' % self.toolname |
160 s = open(self.opts.script_path,'r').readlines() | 160 s = open(self.opts.script_path,'r').readlines() |
161 s = [x.rstrip() for x in s] # remove pesky dos line endings if needed | 161 s = [x.rstrip() for x in s] # remove pesky dos line endings if needed |
162 s = [x.lstrip() for x in s] # and left padding | 162 # s = [x.lstrip() for x in s] # and left padding |
163 self.script = '\n'.join(s) | 163 self.script = '\n'.join(s) |
164 fhandle,self.sfile = tempfile.mkstemp(prefix=self.toolname,suffix=".%s" % (opts.interpreter)) | 164 fhandle,self.sfile = tempfile.mkstemp(prefix=self.toolname,suffix=".%s" % (opts.interpreter)) |
165 tscript = open(self.sfile,'w') # use self.sfile as script source for Popen | 165 tscript = open(self.sfile,'w') # use self.sfile as script source for Popen |
166 tscript.write(self.script) | 166 tscript.write(self.script) |
167 tscript.close() | 167 tscript.close() |