def getProjects( configDoc ): """ get the projects that need publish """ publishProjectsElement = XMLUtils.findAllElements( configDoc, "publishProjects/project/path") projectsDir = [] for projectElement in publishProjectsElement: projectPath = XMLUtils.getElementValue( projectElement ) projectsDir.append( projectPath ) return projectsDir
def removeFiles( configDoc ): projectsElement = XMLUtils.findAllElements( configDoc, "publishProjects/project" ) for projectElement in projectsElement: projectName = XMLUtils.findSubElementValue( projectElement, "path" ) projectPath = os.path.join( sys.argv[2], projectName ) # remove the dir dirsElement = XMLUtils.findAllElements( projectElement, "removeFiles/dirs/dir" ) for dirElement in dirsElement: dirName = XMLUtils.getElementValue( dirElement ) if dirName is None: continue dirPath = os.path.join( projectPath, dirName ) XFileUtil.rmTree( dirPath ) #remove files filesElement = XMLUtils.findAllElements( projectElement, "removeFiles/files/file" ) for fileElement in filesElement: fileName = XMLUtils.getElementValue( fileElement ) if fileName is None: continue filePath = os.path.join( projectPath, fileName ) XFileUtil.deleteFile( filePath ) pass