def getWorkflowPathByRecursive(self ,dirPath): if dirPath.find(".svn") >= 0: return #获得目录下所有文件的内容 dirPath = ''.join(dirPath.split()) dirs = os.listdir(dirPath) for dirSin in dirs: rootPath = dirPath rootPath = '%s%s%s' % (rootPath , '\\' ,dirSin) isDir = os.path.isdir(rootPath) #如果是目录,并且存在workflow.xml,打包部署,返回 #否则,递归 if isDir is False: #如果是文件,判断是否是workflow.xml,如果是,部署 flagString = 'job.properties' name = 'workflow.xml' josIndex = rootPath.find(flagString) if josIndex >= 0: #部署 #工作流目录路径 workflowPath = rootPath.replace(flagString, '') #工作流路径 workflowFilePath = '%s\%s' % (workflowPath ,name) #部署之后的目录的名称 #格式${workflwname}-${codeVersion}-${svnVersion} targetName = '%s-%s-%s' % (self.getWorkflowName(workflowFilePath) ,self.codeVersion ,self.svnVersion) deploy = Deploy(dirPath ,targetName) deploy.copy() return else: self.getWorkflowPathByRecursive(rootPath)
def testName(self): workflowPath = '' workflowDirName = '' deploy = Deploy(workflowPath ,workflowDirName) deploy.copyJar(); pass