def copyFiles(configData): if False == configData.has_key(s_copyFileKey): ColorPrint.errorPrint("没有定义复制文件") return copyFilesConfig = configData[s_copyFileKey] for _, value in enumerate(copyFilesConfig): targetFolder = getFileTargetFolder(value) source = value[s_sourceKey] isNew = isNewFromConfig(value) isFilter = isFilterFormConfig(value) if s_jsonTrue == isFilter: continue if not os.path.exists(g_projectPath + targetFolder): FileUtils.newFolder(g_projectPath + targetFolder) if s_jsonTrue == isNew: FileUtils.deleteFile(g_projectPath + targetFolder + source) FileUtils.copyFile(s_sourcePath + source , g_projectPath + targetFolder + source) ColorPrint.colorPrint("Copy " + s_sourcePath + source) elif not os.path.isfile(g_projectPath + targetFolder + source): FileUtils.copyFile(s_sourcePath + source , g_projectPath + targetFolder + source) ColorPrint.colorPrint("Copy " + s_sourcePath + source)
def copyFiles(configData): if False == configData.has_key(s_copyFileKey): ColorPrint.errorPrint("没有定义复制文件") return copyFilesConfig = configData[s_copyFileKey] for _, value in enumerate(copyFilesConfig): targetFolder = getFileTargetFolder(value) source = value[s_sourceKey] isNew = isNewFromConfig(value) isFilter = isFilterFormConfig(value) if s_jsonTrue == isFilter: continue if not os.path.exists(g_projectPath + targetFolder): FileUtils.newFolder(g_projectPath + targetFolder) if s_jsonTrue == isNew: FileUtils.deleteFile(g_projectPath + targetFolder + source) FileUtils.copyFile(s_sourcePath + source, g_projectPath + targetFolder + source) ColorPrint.colorPrint("Copy " + s_sourcePath + source) elif not os.path.isfile(g_projectPath + targetFolder + source): FileUtils.copyFile(s_sourcePath + source, g_projectPath + targetFolder + source) ColorPrint.colorPrint("Copy " + s_sourcePath + source)
def fileAction(apkFileName, versionName): apkFilePath = FileUtils.getAbsolutePath(g_projectPath + s_binFolder + apkFileName) targetFolder = getTargetFolderPath(versionName) targetFile = os.path.join(targetFolder, apkFileName) FileUtils.copyFile(apkFilePath, targetFolder + "/" +apkFileName) renameFile(targetFile, versionName)