def mergeFunc(self, products) : def printComment(lines) : skip = ['Source file','Target path','Found subdirectory'] line = next(L for L in lines.split('\n') if not any(item in L for item in skip)) print line.replace("Target","The output") + " has been written." def cleanUp(stderr, files) : assert not stderr, "hadd had this stderr: %s"%stderr for fileName in files : os.remove(fileName) if not all(os.path.exists(fileName) for fileName in products["outputFileName"]) : return hAdd = utils.getCommandOutput("./phaddy -f %s %s"%(self.outputFileName, " ".join(products["outputFileName"]))) printComment(hAdd["stdout"]) cleanUp(hAdd["stderr"], products["outputFileName"])
def mergeFunc(self, products) : def printComment(lines) : skip = ['Source file','Target path','Found subdirectory'] line = next(L for L in lines.split('\n') if not any(item in L for item in skip)) print line.replace("Target","The output") + " has been written." def cleanUp(stderr, files) : okList = ["", "Exception in thread QueueFeederThread (most likely raised during interpreter shutdown):"] assert (stderr in okList), "hadd had this stderr: %s"%stderr if stderr : print stderr for fileName in files : os.remove(fileName) if not all(os.path.exists(fileName) for fileName in products["outputFileName"]) : return hAdd = utils.getCommandOutput("./phaddy -f %s %s"%(self.outputFileName, " ".join(products["outputFileName"]))) printComment(hAdd["stdout"]) cleanUp(hAdd["stderr"], products["outputFileName"])
def lines(cmd) : return utils.getCommandOutput(cmd)["stdout"].split("\n")