def _InitOutputDir(self, ui): """Initialize output directory.""" try: files.RemoveTree(self.out_dir) files.CopyTree(self.src_dir, self.out_dir) except Exception: ui.errors.Exception(self) yield False yield True
def _ExecForCompile(self, args): for f in files.ListDir(self.src_dir): srcpath = os.path.join(self.src_dir, f) dstpath = os.path.join(self.out_dir, f) if os.path.isdir(srcpath): files.CopyTree(srcpath, dstpath) else: files.CopyFile(srcpath, dstpath) if len(self.dependency) > 0: if libdir is None: raise IOError('library_dir is not defined.') else: for f in self.dependency: if not os.path.exists(os.path.join(libdir, f)): raise IOError('%s is not found in %s.' % (f, libdir)) files.CopyFile(os.path.join(libdir, f), self.out_dir) with open(os.path.join(self.out_dir, self.log_name), 'w') as outfile: yield (yield self._ExecInternal(args=args, cwd=self.out_dir, stdin=files.OpenNull(), stdout=outfile, stderr=subprocess.STDOUT))