Exemple #1
0
 def createOutputFile(self, ext, contents=""):
     """create an output file, filling it with contents."""
     fpath = self.getOutputFile(ext)
     fileOps.ensureFileDir(fpath)
     fh = open(fpath, "w")
     try:
         fh.write(contents)
     finally:
         fh.close()
Exemple #2
0
 def createOutputFile(self, ext, contents=""):
     """create an output file, filling it with contents."""
     fpath = self.getOutputFile(ext)
     fileOps.ensureFileDir(fpath)
     fh = open(fpath, "w")
     try:
         fh.write(contents)
     finally:
         fh.close()
Exemple #3
0
 def _touch(self, fp):
     "create a file product"
     self.tester.failUnless(isinstance(fp, File))
     ext = os.path.splitext(fp.path)[1]
     fileOps.ensureFileDir(fp.getOutPath())
     fh = open(fp.getOutPath(), "w")
     try:
         fh.write(self.pset.contents.get(fp))
     finally:
         fh.close()
         self.touchCnt += 1
Exemple #4
0
 def _touch(self, fp):
     "create a file product"
     self.tester.failUnless(isinstance(fp, File))
     ext = os.path.splitext(fp.path)[1]
     fileOps.ensureFileDir(fp.getOutPath())
     fh = open(fp.getOutPath(), "w")
     try:
         fh.write(self.pset.contents.get(fp))
     finally:
         fh.close()
         self.touchCnt += 1
Exemple #5
0
 def getOutPath(self, autoCompress=True):
     """Get the output name for the file, which is newPath until the rule
     terminates. This will also create the output directory for the file,
     if it does not exist.  One wants to use FileOut() to define
     a command argument.  This should not be used to get the path to a file
     to be opened in the ExRun process, use openOut() instead."""
     if self.installed:
         raise ExRunException("output file already installed: " + self.path)
     if self.outPath == None:
         fileOps.ensureFileDir(self.path)
         self.outPath = self.exrun.getAtomicPath(self.path)
     return self.outPath
Exemple #6
0
 def getOutPath(self, autoCompress=True):
     """Get the output name for the file, which is newPath until the rule
     terminates. This will also create the output directory for the file,
     if it does not exist.  One wants to use FileOut() to define
     a command argument.  This should not be used to get the path to a file
     to be opened in the ExRun process, use openOut() instead."""
     if self.installed:
         raise ExRunException("output file already installed: " + self.path)
     if self.outPath == None:
         fileOps.ensureFileDir(self.path)
         self.outPath = self.exrun.getAtomicPath(self.path)
     return self.outPath
Exemple #7
0
 def getOutputFile(self, ext):
     """Get path to the output file, using the current test id and append
     ext, which should contain a dot"""
     f = self.getOutputDir() + "/" + self.getId() + ext
     fileOps.ensureFileDir(f)
     return f
Exemple #8
0
 def execute(self):
     "create file product"
     for fp in self.produces:
         fileOps.ensureFileDir(fp.path)
         open(fp.path, "w").close()
Exemple #9
0
 def getOutputFile(self, ext):
     """Get path to the output file, using the current test id and append
     ext, which should contain a dot"""
     f = self.getOutputDir() + "/" + self.getId() + ext;
     fileOps.ensureFileDir(f)
     return f