def get_release_notes_path(self, updated_package_url, username, password, local_path): ''' 获取版本说明路径,包括几个步骤: 1、下载版本说明到本地路径 2、返回本地路径 ''' if updated_package_url == None: print("请填写版本说明父目录url") return(None) if os.path.exists(local_path): pywincmds.del_dir(local_path) #print("svn co --depth files", updated_package_url, revision, local_path, sourcecode["username"], sourcecode["password"]) pysvn.co(updated_package_url, local_path, username, password, depth="files") files = os.listdir(local_path) release_notes_path = "" for file in files: if file.find("版本说明") > -1: new_file = (local_path + os.sep + file).replace('版本说明', 'release_notes', 1) os.rename(local_path + os.sep + file, new_file) release_notes_path = new_file if not release_notes_path: print("版本说明路径不对,请重新输入") exit(1) else: return(release_notes_path)
def substitute(self, src, dst): if not os.path.exists(src): print(src + "不存在!") return try: if os.path.isdir(dst): pywincmds.del_dir(dst) pywincmds.robocopy(src, dst) elif os.path.isfile(dst): pywincmds.copy(src, dst) except Exception as e: print(e)