def _copy_code_templates(): # Copy all .cs code templates to CLIENT_PATH. for f in FileUtil.get_files(CODE_TEMPL_PATH, exts=('.cs', )): FileUtil.copy(f, CLIENT_PATH) # Copy all .py code templates to SERVER_PATH. for f in FileUtil.get_files(CODE_TEMPL_PATH, exts=('.py', )): FileUtil.copy(f, SERVER_PATH)
def main(): if not dataPath or (not msgPath): return svn = pysvn.Client() versionStr = "" lenList = len(allPath) for index, tPath in enumerate(allPath): LogList = svn.log(tPath, limit=1) info = LogList[0] versionNum = info.revision.number if index == (lenList - 1): versionStr += str(versionNum) else: versionStr += str(versionNum) versionStr += "." exportPath1 = op.join(op.dirname(dataPath), "version") exportPath = op.join(exportPath1, 'version.txt') f = open(exportPath, 'w') f.write(versionStr) f.close() SvnCmd(path=exportPath, cmd='commit', logmsg='Commit version text.{}||{}'.format(exportPath1, SERV_VERSION_DIR)).Run() # copy version 到 trunk SvnCmd(path=SERV_VERSION_DIR, cmd='update', logmsg='update version files.').Run() update_files_version, add_files_version = FileUtil.copy( exportPath1, SERV_VERSION_DIR, suffixes=('.txt', ), force=True) # print("{} .txt files {}".format("#" * 16, "#" * 16)) # print("updated:") # # prettyOutput(update_files_version) # print('') if add_files_version: print("added:") prettyOutput(add_files_version) for new_file in add_files_version: dst_file = op.join(SERV_VERSION_DIR, op.basename(new_file)) SvnCmd(path=dst_file, cmd='add', logmsg='add new config data files').Run() SvnCmd(path=SERV_VERSION_DIR, cmd='commit', logmsg='commit version files').Run()
def main(): code_dir = op.join(GENED_CODE_DIR, 'run', 'server') data_dir = op.join(GENED_CODE_DIR, 'run', 'data') dest_dir = raw_input("please write dest_dir:\n") dest_dir = op.join(dest_dir, 'server', 'config', 'game') if not op.exists(dest_dir): print '>>> ' + dest_dir + ' not exist. ' os.system('pause') return SvnCmd(path=dest_dir, cmd='update', logmsg='update config files').Run() SvnCmd(path=op.join(dest_dir, 'data'), cmd='update', logmsg='update config files').Run() update_files_cfg, add_files_cfg = FileUtil.copy(code_dir, dest_dir, suffixes=('.py', ), force=True) update_files_data, add_files_data = FileUtil.copy(data_dir, op.join( dest_dir, 'data'), suffixes=('.data', ), force=True) update_files_json, add_files_json = FileUtil.copy(data_dir, op.join( dest_dir, 'data'), suffixes=('.json', ), force=True) print("{} .data files {}".format("#" * 16, "#" * 16)) print("updated:") prettyOutput(update_files_data) print('') if add_files_data: print("added:") prettyOutput(add_files_data) for new_file in add_files_data: dst_file = op.join(op.join(dest_dir, 'data'), op.basename(new_file)) SvnCmd(path=dst_file, cmd='add', logmsg='add new config data files').Run() print("{} .cfg files {} ".format("#" * 16, "#" * 16)) print("updated:") prettyOutput(update_files_cfg) print('') if add_files_cfg: print("added:") prettyOutput(add_files_cfg) for new_file in add_files_cfg: dst_file = op.join(dest_dir, op.basename(new_file)) SvnCmd(path=dst_file, cmd='add', logmsg='add new config files').Run() print("{} .json files {}".format("#" * 16, "#" * 16)) print("updated:") prettyOutput(update_files_json) print('') if add_files_json: print("added:") prettyOutput(add_files_json) for new_file in add_files_json: dst_file = op.join(op.join(dest_dir, 'data'), op.basename(new_file)) SvnCmd(path=dst_file, cmd='add', logmsg='add new config json files').Run() SvnCmd(path=dest_dir, cmd='commit', logmsg='update config files').Run()
def copy2Serv(): if not op.exists(SERV_CFG_DIR) or not op.exists(SERV_DATA_DIR): print("ONLY used for server part.") print("path:{} or {} not existed!".format(SERV_DATA_DIR, SERV_CFG_DIR)) return False SvnCmd(path=SERV_DATA_DIR, cmd='update', logmsg='update config files').Run() SvnCmd(path=SERV_CFG_DIR, cmd='update', logmsg='update config files').Run() SvnCmd(path=SERV_VERSION_DIR, cmd='update', logmsg='update version files').Run() update_files_data, add_files_data = FileUtil.copy(GENED_DATA_DIR, SERV_DATA_DIR, suffixes=('.data', ), force=True) update_files_cfg, add_files_cfg = FileUtil.copy(GENED_CFG_DIR, SERV_CFG_DIR, suffixes=('.py', ), force=True) update_files_json, add_files_json = FileUtil.copy(GENED_DATA_DIR, SERV_DATA_DIR, suffixes=('.json', ), force=True) update_files_version, add_files_version = FileUtil.copy( GEND_VERSION_DIR, SERV_VERSION_DIR, suffixes=('.txt', ), force=True) print("{} .data files {}".format("#" * 16, "#" * 16)) print("updated:") prettyOutput(update_files_data) print('') if add_files_data: print("added:") prettyOutput(add_files_data) for new_file in add_files_data: dst_file = op.join(SERV_DATA_DIR, op.basename(new_file)) SvnCmd(path=dst_file, cmd='add', logmsg='add new config data files').Run() print("{} .cfg files {} ".format("#" * 16, "#" * 16)) print("updated:") prettyOutput(update_files_cfg) print('') if add_files_cfg: print("added:") prettyOutput(add_files_cfg) for new_file in add_files_cfg: dst_file = op.join(SERV_CFG_DIR, op.basename(new_file)) SvnCmd(path=dst_file, cmd='add', logmsg='add new config files').Run() print("{} .json files {}".format("#" * 16, "#" * 16)) print("updated:") prettyOutput(update_files_json) print('') if add_files_json: print("added:") prettyOutput(add_files_json) for new_file in add_files_json: dst_file = op.join(SERV_DATA_DIR, op.basename(new_file)) SvnCmd(path=dst_file, cmd='add', logmsg='add new config json files').Run() SvnCmd(path=SERV_CFG_DIR, cmd='commit', logmsg='update config files').Run() print("{} .txt files {}".format("#" * 16, "#" * 16)) print("updated:") prettyOutput(update_files_version) print('') if add_files_version: print("added:") prettyOutput(add_files_version) for new_file in add_files_version: dst_file = op.join(SERV_VERSION_DIR, op.basename(new_file)) SvnCmd(path=dst_file, cmd='add', logmsg='add new data version txt files').Run() SvnCmd(path=SERV_VERSION_DIR, cmd='commit', logmsg='commit data version txt files').Run()