def removePath(self, path): # Mercurial doesn't remove unknown files, nor does it return non-zero exit codes when it fails retValue = os.path.exists(path) self.callProgram( "rm", [self.correctForLinks(path)]) # returns 0 whatever happens plugins.removePath(path) return retValue
def cleanSlaveFiles(self, test): if self.useCloud: # Don't keep anything on a remote system, we've transferred it all back anyhow... writeDir = test.getDirectory(temporary=1) plugins.rmtree(writeDir) elif test.state.hasSucceeded(): writeDir = test.getDirectory(temporary=1) # If we've made screenshots, keep them, we might want to look at them... if os.path.isdir(os.path.join(writeDir, "screenshots")): for f in os.listdir(writeDir): if f != "screenshots": plugins.removePath(os.path.join(writeDir, f)) else: plugins.rmtree(writeDir) else: for dataFile in self.getDataFiles(test): fullPath = test.makeTmpFileName(dataFile, forComparison=0) plugins.removePath(fullPath)
def removePath(self, path): if os.path.isdir(path): retCode = self.callProgram("rm", [path]) else: # removing a file affects the directory it lives in, whereas removing a directory shouldn't # affect the parent... retCode = self.callProgram("rm", [path], cwd=os.path.dirname(path)) if retCode > 0: # Wasn't in version control, probably return plugins.removePath(path) else: self.cleanUnknownFiles(path) return True
def removePath(dir): return plugins.removePath(dir)
def removePath(self, path): # Git doesn't remove unknown files retCode = self.callProgram("rm", [path]) plugins.removePath(path) return retCode == 0