コード例 #1
0
def main():
    os.chdir(os.path.split(os.path.realpath(__file__))[0])

    Common.welcome('脚本指令添加助手')

    options = {
        'source_dirs':
        '../../src',
        'process_exts': ['.hpp', '.cpp'],
        'mark_format':
        r'// PYHELP - SCRIPTCMD - INSERT POINT - <Section (\d{1,2})>',
        'mark_enum':
        InjectPoint,
        'mark_configure': [{
            'id': InjectPoint.PANDAS_SWITCH_DEFINE,
            'desc': 'pandas.hpp @ 宏定义'
        }, {
            'id': InjectPoint.SCRIPT_BUILDIN_FUNC,
            'desc': 'script.cpp @ BUILDIN_FUNC 脚本指令实际代码'
        }, {
            'id': InjectPoint.SCRIPT_BUILDIN_DEF,
            'desc': 'script.cpp @ BUILDIN_DEF 脚本指令导出'
        }]
    }

    guide(Injecter(options))
    Common.exit_with_pause()
コード例 #2
0
def main():
    os.chdir(os.path.split(os.path.realpath(__file__))[0])

    Common.welcome('战斗配置选项添加助手')

    options = {
        'source_dirs' : ['../../src', '../../conf/battle'],
        'process_exts' : ['.hpp', '.cpp', '.conf'],
        'mark_format' : r'// PYHELP - BATTLECONFIG - INSERT POINT - <Section (\d{1,2})>',
        'mark_enum': InjectPoint,
        'mark_configure' : [
            {
                'id' : InjectPoint.PANDAS_SWITCH_DEFINE,
                'desc' : 'pandas.hpp @ 宏定义'
            },
            {
                'id' : InjectPoint.BATTLE_VAR_DEFINE,
                'desc' : 'battle.hpp @ 战斗配置选项的变量声明'
            },
            {
                'id' : InjectPoint.BATTLE_DEFAULT_DEFINE,
                'desc' : 'battle.cpp @ 战斗配置选项的关联和默认值配置'
            },
            {
                'id' : InjectPoint.PANDAS_CONF_INSERT,
                'desc' : 'pandas.conf @ 战斗配置选项的默认添加位置'
            }
        ]
    }

    guide(Injecter(options))
    Common.exit_with_pause()
コード例 #3
0
ファイル: imple_versions.py プロジェクト: aicaac/Pandas
def main():
    os.chdir(os.path.split(os.path.realpath(__file__))[0])

    Common.welcome('版本号修改辅助脚本')

    print('')

    # 读取当前的 Pandas 主程序版本号
    pandas_ver = Common.get_pandas_ver(os.path.abspath(project_slndir),
                                       origin=True)
    Message.ShowInfo('当前模拟器的主版本是 %s' % pandas_ver)

    print('')

    # 询问获取升级后的目标版本
    newver = Inputer().requireText(
        {'tips': '请输入新的版本号 (四段式: 1.0.0.1, 最后一段为 1 则表示为开发版)'})

    if not isVersionFormatValid(newver):
        Message.ShowError('你输入的版本号: %s 不符合四段式规则, 请重试...' % newver)
        Common.exit_with_pause(-1)

    # 执行更新操作
    ver = VersionUpdater(options)
    ver.updateDirectory(slndir('src'), newver)

    Common.exit_with_pause()
コード例 #4
0
def main():
    os.chdir(os.path.split(os.path.realpath(__file__))[0])

    Common.welcome('地图标记添加助手')

    options = {
        'source_dirs' : '../../src',
        'process_exts' : ['.hpp', '.cpp'],
        'mark_format' : r'// PYHELP - MAPFLAG - INSERT POINT - <Section (\d{1,2})>',
        'mark_enum': InjectPoint,
        'mark_configure' : [
            {
                'id' : InjectPoint.PANDAS_SWITCH_DEFINE,
                'desc' : 'pandas.hpp @ 宏定义'
            },
            {
                'id' : InjectPoint.MAP_MAPFLAG_DEFINE,
                'desc' : 'map.hpp @ MF_XXX 常量定义'
            },
            {
                'id' : InjectPoint.SCRIPT_CONSTANTS_EXPORT,
                'desc' : 'script_constants.hpp @ MF_XXX 常量导出'
            },
            {
                'id' : InjectPoint.ATCOMMAND_MAPFLAG_BLOCK,
                'desc' : 'atcommand.cpp @ mapflag GM指令的赋值屏蔽处理'
            },
            {
                'id' : InjectPoint.MAP_GETMAPFLAG_SUB,
                'desc' : 'map.cpp @ map_getmapflag_sub 的读取标记处理'
            },
            {
                'id' : InjectPoint.MAP_SETMAPFLAG_SUB,
                'desc' : 'map.cpp @ map_setmapflag_sub 的设置标记处理'
            },
            {
                'id' : InjectPoint.NPC_PARSE_MAPFLAG,
                'desc' : 'npc.cpp @ npc_parse_mapflag 可选的标记处理'
            },
            {
                'id' : InjectPoint.ATCOMMAND_MAPINFO,
                'desc' : 'atcommand.cpp @ ACMD_FUNC(mapinfo) 可选的地图信息输出'
            },
            {
                'id' : InjectPoint.SCRIPT_SETMAPFLAG,
                'desc' : 'script.cpp @ setmapflag 可选的脚本设置标记参数处理代码'
            },
            {
                'id' : InjectPoint.SCRIPT_GETMAPFLAG,
                'desc' : 'script.cpp @ getmapflag 可选的脚本读取标记参数处理代码'
            }
        ]
    }

    guide(Injecter(options))
    Common.exit_with_pause()
コード例 #5
0
def main():
    # 加载 .env 中的配置信息
    load_dotenv(dotenv_path='.config.env', encoding='UTF-8')

    # 若无配置信息则自动复制一份文件出来
    if not Common.is_file_exists('.config.env'):
        shutil.copyfile('.config.env.sample', '.config.env')

    # 显示欢迎信息
    Common.welcome('格式化占位符检查辅助脚本')
    print('')

    # 执行检查工作
    for i in entrance_configure:
        do_check_file(os.path.abspath(project_slndir + i))

    # 友好退出, 主要是在 Windows 环境里给予暂停
    Common.exit_with_pause()
コード例 #6
0
ファイル: pyhelp_symstore.py プロジェクト: lth1986/Pandas
def main():
    # 显示欢迎信息
    Common.welcome('符号归档辅助脚本')
    print('')
    
    # 检查是否已经完成了编译
    if not Common.is_compiled(project_slndir):
        Message.ShowWarning('检测到打包需要的编译产物不完整, 请重新编译. 程序终止.')
        Common.exit_with_pause(-1)

    # 检查符号仓库是否存在, 不存在则创建
    if not ensure_store():
        Message.ShowWarning('你放弃了拉取符号仓库, 后续工作无法继续. 程序终止.')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('符号仓库已经存在于本地, 开始确认工作区状态...')

    # 若符号文件存在, 则确保工作区干净
    if not ensure_store_clean():
        Message.ShowWarning('为了防止出现意外, 请确保符号仓库的工作区是干净的. 程序终止.')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('很好, 符号仓库的工作区是干净的.')
    
    # 尝试更新本地的符号仓库到最新
    if not update_store():
        Message.ShowWarning('为了防止出现意外, 请确保符号仓库同步到最新. 程序终止.')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('符号仓库已经同步到最新, 开始归档新的符号文件...')

    # 搜索工程目录全部 pdb 文件和 exe 文件, 进行归档
    deploy_symbols(project_slndir)
    
    # 自动进行 git 提交操作
    Message.ShowStatus('归档完毕, 正在提交...')
    if not make_commit():
        Message.ShowWarning('很抱歉, 提交失败! 请确认失败的原因. 程序终止.')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('提交成功, 请手工推送到远程仓库.')
    
    # 友好退出, 主要是在 Windows 环境里给予暂停
    Common.exit_with_pause()
コード例 #7
0
def main():
    Common.welcome('终端翻译对照表提取助手')

    options = [{
        'name': '建立新的翻译对照表文件',
        'desc': '0 - 建立新的翻译对照表文件'
    }, {
        'name': '更新现有的翻译对照表文件',
        'desc': '1 - 更新现有的翻译对照表文件'
    }, {
        'name': '基于简体中文汉化结果更新繁体中文数据',
        'desc': '2 - 基于简体中文汉化结果更新繁体中文数据'
    }]

    userchoose = Inputer().requireSelect({
        'prompt': '想要执行的操作或任务',
        'option_name': '操作或任务',
        'data': options
    })

    if userchoose == 1:
        updatever = Inputer().requireBool({
            'tips': '完成更新后是否提升数据版本号?',
            'default': False
        })

    extracter = TranslationExtracter()

    if userchoose == 0:
        extracter.build(project_slndir + 'src')
        extracter.dump('translation.yml')
    elif userchoose == 1:
        extracter.build(project_slndir + 'src')
        extracter.updateall(updatever)
    elif userchoose == 2:
        extracter.load(project_slndir + 'conf/msg_conf/translation_cn.yml')
        extracter.toTraditional()
        extracter.dump(project_slndir + 'conf/msg_conf/translation_tw.yml')

    Common.exit_with_pause()
コード例 #8
0
def main():
    '''
    主入口函数
    '''
    Common.welcome('游戏文本转译辅助脚本')

    langtype = Inputer().requireSelect({
        'prompt':
        '需要将文本翻译成的目标语言类型',
        'option_name':
        '目标语言',
        'data': [{
            'name': '简体中文',
            'desc': '0 - 汉化成简体中文'
        }, {
            'name': '繁体中文',
            'desc': '1 - 汉化成繁体中文'
        }]
    })

    process(project_slndir, 'zh-cn' if langtype == 0 else 'zh-tw')

    Common.exit_with_pause()
コード例 #9
0
ファイル: pyhelp_publish.py プロジェクト: lth1986/Pandas
def main():
    '''
    主入口函数
    '''
    # 显示欢迎信息
    Common.welcome('打包流程辅助脚本')
    print('')

    pandas_ver = Common.get_pandas_ver(os.path.abspath(project_slndir))
    Message.ShowInfo('当前模拟器的主版本是 %s' % pandas_ver)

    # 检查是否已经完成了编译
    if not Common.is_compiled(project_slndir):
        Message.ShowWarning('检测到打包需要的编译产物不完整, 请重新编译. 程序终止.')
        print('')
        Common.exit_with_pause(-1)

    # 导出当前仓库, 变成一个归档压缩文件
    Message.ShowInfo('正在将当前分支的 HEAD 内容导出成归档文件...')
    export_file = export()
    if not export_file:
        Message.ShowError('很抱歉, 导出归档文件失败, 程序终止.')
        Common.exit_with_pause(-1)
    Message.ShowInfo('归档文件导出完成, 此文件将在程序结束时被删除.') 

    # 基于归档压缩文件, 进行打包处理
    process(export_file, renewal=True)
    process(export_file, renewal=False)

    # 执行一些清理工作
    clean(export_file)

    print('')
    Message.ShowInfo('已经成功打包相关文件, 请进行人工核验.')

    # 友好退出, 主要是在 Windows 环境里给予暂停
    Common.exit_with_pause()
コード例 #10
0
def main():
    os.chdir(os.path.split(os.path.realpath(__file__))[0])

    Common.welcome('源代码文件编码转换助手')
    print('')

    confirm = Inputer().requireBool({
        'tips': '是否立刻进行文件编码转换?',
        'default': False
    })

    if not confirm:
        Message.ShowInfo('您取消了操作, 程序终止...\n')
        Common.exit_with_pause()

    count = CharsetConverter({
        'ignore_files': ['Makefile', 'Makefile.in', 'CMakeLists.txt'],
        'process_exts': ['.hpp', '.cpp', '.h', '.c']
    }).convertDirectory('../../src', 'UTF-8-SIG')

    if count <= 0:
        Message.ShowInfo('很好! 源代码文件都已转换为 UTF-8-SIG 编码.')

    Common.exit_with_pause()
コード例 #11
0
ファイル: dawn_compile.py プロジェクト: aicaac/Pandas
def main():
    '''
    主入口函数
    '''
    # 加载 .env 中的配置信息
    load_dotenv(dotenv_path='.config.env', encoding='UTF-8')

    # 若无配置信息则自动复制一份文件出来
    if not Common.is_file_exists('.config.env'):
        shutil.copyfile('.config.env.sample', '.config.env')

    # 显示欢迎信息
    Common.welcome('编译流程辅助脚本')

    # 只能在 Windows 环境运行
    if platform.system() != 'Windows':
        Message.ShowError('很抱歉, 此脚本只能在 Windows 环境上运行')
        Common.exit_with_pause(-1)

    # 判断本机是否安装了支持的 Visual Studio
    detected_vs, vs_name = detect_vs()
    if not detected_vs:
        Message.ShowError('无法检测到合适的 Visual Studio 版本 (2015 或 2017)')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('检测到已安装: %s 应可正常编译' % vs_name)

    print('')

    # 读取当前的 Pandas 主程序版本号
    pandas_ver = Common.get_pandas_ver(os.path.abspath(project_slndir))
    Message.ShowInfo('当前模拟器的主版本是 %s' % pandas_ver)

    # 判断是否已经写入了对应的更新日志, 若没有则要给予提示再继续
    if (has_changelog(pandas_ver)):
        Message.ShowStatus('已经在更新日志中找到了 %s 的版本信息.' % pandas_ver)
    else:
        Message.ShowWarning('没有在更新日志中找到 %s 版本的信息, 请注意完善!' % pandas_ver)

    # 判断当前 git 工作区是否干净, 若工作区不干净要给予提示
    if git.Repo(project_slndir).is_dirty():
        if not Inputer().requireBool({
                'tips': '当前模拟器代码仓库的工作区不干净, 要继续编译吗?',
                'default': False
        }):
            Message.ShowStatus('您主动放弃了继续操作')
            Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('当前模拟器代码仓库的工作区是干净的.')

    # 检查 Crashrpt 使用的信息是否都设置好了, 若没有且企图编译正式版, 则给与提示
    if Common.is_pandas_release(os.path.abspath(project_slndir)):
        if not os.getenv("DEFINE_CRASHRPT_APPID"):
            Message.ShowWarning('当前并未设置 AppID, 且企图编译正式版.')
            Common.exit_with_pause(-1)
        if Common.md5(os.getenv("DEFINE_CRASHRPT_APPID")
                      ) != '952648de2d8f063a07331ae3827bc406':
            Message.ShowWarning('当前已设置了 AppID, 但并非正式版使用的 AppID.')
            Common.exit_with_pause(-1)
        if not os.getenv("DEFINE_CRASHRPT_PUBLICKEY"):
            Message.ShowWarning('当前并未设置 PublicKey, 且企图编译正式版.')
            Common.exit_with_pause(-1)

    Message.ShowStatus('即将开始编译, 编译速度取决于电脑性能, 请耐心...')

    # 清理目前的工作目录, 把一些可明确移除的删掉
    clean_environment()

    # 编译 Pandas 的复兴前版本
    compile_prere(pandas_ver)

    # 编译 Pandas 的复兴后版本
    compile_renewal(pandas_ver)

    Message.ShowStatus('编译工作已经全部结束, 请归档符号并执行打包流程.')

    # 友好退出, 主要是在 Windows 环境里给予暂停
    Common.exit_with_pause()
コード例 #12
0
ファイル: dawn_publish.py プロジェクト: CairoLee/Pandas
def main():
    '''
    主入口函数
    '''
    # 加载 .env 中的配置信息
    load_dotenv(dotenv_path='.config.env', encoding='UTF-8')

    # 若无配置信息则自动复制一份文件出来
    if not Common.is_file_exists('.config.env'):
        shutil.copyfile('.config.env.sample', '.config.env')

    # 显示欢迎信息
    Common.welcome('打包流程辅助脚本')
    print('')

    pandas_ver = Common.get_pandas_ver(os.path.abspath(project_slndir))
    Message.ShowInfo('当前模拟器的主版本是 %s' % pandas_ver)

    # 若环境变量为空则设置个默认值
    if not os.getenv('DEFINE_PROJECT_NAME'):
        os.environ["DEFINE_PROJECT_NAME"] = "Pandas"

    if not os.getenv('DEFINE_COMPILE_MODE'):
        os.environ["DEFINE_COMPILE_MODE"] = "re,pre"

    Message.ShowInfo('当前输出的项目名称为: %s' % os.getenv('DEFINE_PROJECT_NAME'))

    # 检查是否已经完成了编译
    if 're' in os.getenv('DEFINE_COMPILE_MODE').split(','):
        if not Common.is_compiled(project_slndir, checkmodel='re'):
            Message.ShowWarning('检测到打包需要的编译产物不完整, 请重新编译. 程序终止.')
            print('')
            Common.exit_with_pause(-1)

    if 'pre' in os.getenv('DEFINE_COMPILE_MODE').split(','):
        if not Common.is_compiled(project_slndir, checkmodel='pre'):
            Message.ShowWarning('检测到打包需要的编译产物不完整, 请重新编译. 程序终止.')
            print('')
            Common.exit_with_pause(-1)

    # 导出当前仓库, 变成一个归档压缩文件
    Message.ShowInfo('正在将当前分支的 HEAD 内容导出成归档文件...')
    export_file = export()
    if not export_file:
        Message.ShowError('很抱歉, 导出归档文件失败, 程序终止.')
        Common.exit_with_pause(-1)
    Message.ShowInfo('归档文件导出完成, 此文件将在程序结束时被删除.')

    # 基于归档压缩文件, 进行打包处理
    if 're' in os.getenv('DEFINE_COMPILE_MODE').split(','):
        process(export_file, renewal=True)

    if 'pre' in os.getenv('DEFINE_COMPILE_MODE').split(','):
        process(export_file, renewal=False)

    # 执行一些清理工作
    clean(export_file)

    print('')
    Message.ShowInfo('已经成功打包相关文件, 请进行人工核验.')

    # 友好退出, 主要是在 Windows 环境里给予暂停
    Common.exit_with_pause()
コード例 #13
0
ファイル: pyhelp_compile.py プロジェクト: linhan85/Pandas
def main():
    '''
    主入口函数
    '''
    # 加载 .env 中的配置信息
    load_dotenv(dotenv_path='pyhelp.conf', encoding='UTF-8-SIG')
    
    # 若无配置信息则自动复制一份文件出来
    if not Common.is_file_exists('pyhelp.conf'):
        shutil.copyfile('pyhelp.conf.sample', 'pyhelp.conf')
    
    # 显示欢迎信息
    Common.welcome('编译流程辅助脚本')

    # 只能在 Windows 环境运行
    if platform.system() != 'Windows':
        Message.ShowError('很抱歉, 此脚本只能在 Windows 环境上运行')
        Common.exit_with_pause(-1)

    # 判断本机是否安装了支持的 Visual Studio
    detected_vs, vs_name = detect_vs()
    if not detected_vs:
        Message.ShowError('无法检测到合适的 Visual Studio 版本 (2015 或 2017)')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('检测到已安装: %s 应可正常编译' % vs_name)

    print('')

    # 读取当前的 Pandas 主程序版本号
    pandas_ver = get_pandas_ver()
    Message.ShowInfo('当前模拟器的主版本是 %s' % pandas_ver)

    # 判断是否已经写入了对应的更新日志, 若没有则要给予提示再继续
    if (has_changelog(pandas_ver)):
        Message.ShowStatus('已经在更新日志中找到了 %s 的版本信息.' % pandas_ver)
    else:
        Message.ShowWarning('没有在更新日志中找到 %s 版本的信息, 请注意完善!' % pandas_ver)

    # 检查创建并尝试更新符号仓库
    update_symstore()

    # 判断当前 git 工作区是否干净, 若工作区不干净要给予提示
    if git.Repo(project_slndir).is_dirty():
        if not Inputer().requireBool({
            'tips' : '当前模拟器代码仓库的工作区不干净, 要继续编译吗?',
            'default' : False
        }):
            Message.ShowStatus('您主动放弃了继续操作')
            Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('当前模拟器代码仓库的工作区是干净的.')
    Message.ShowStatus('即将开始编译, 编译速度取决于电脑性能, 请耐心...')

    # 清理目前的工作目录, 把一些可明确移除的删掉
    clean_environment()

    # 编译 Pandas 的复兴前版本
    compile_prere(pandas_ver)

    # 将复兴前版本的编译产物重命名一下, 避免编译复兴后版本时被覆盖
    shutil.move(slndir('login-server.exe'), slndir('login-server-pre.exe'))
    shutil.move(slndir('login-server.pdb'), slndir('login-server-pre.pdb'))
    shutil.move(slndir('char-server.exe'), slndir('char-server-pre.exe'))
    shutil.move(slndir('char-server.pdb'), slndir('char-server-pre.pdb'))
    shutil.move(slndir('map-server.exe'), slndir('map-server-pre.exe'))
    shutil.move(slndir('map-server.pdb'), slndir('map-server-pre.pdb'))

    # 编译 Pandas 的复兴后版本
    print('')
    compile_renewal(pandas_ver)

    print('')
    Message.ShowStatus('编译工作已经全部结束.')
    Message.ShowStatus('编译时产生的符号文件已存储, 记得提交符号文件.\n')

    # 友好退出, 主要是在 Windows 环境里给予暂停
    Common.exit_with_pause(0)
コード例 #14
0
def main():
    os.chdir(os.path.split(os.path.realpath(__file__))[0])

    Common.welcome('NPC事件添加助手')

    options = {
        'source_dirs':
        '../../src',
        'process_exts': ['.hpp', '.cpp'],
        'mark_format':
        r'// PYHELP - NPCEVENT - INSERT POINT - <Section (\d{1,2})>',
        'mark_enum':
        InjectPoint,
        'mark_configure': [{
            'id': InjectPoint.F_PANDAS_SWITCH_DEFINE,
            'desc': 'pandas.hpp @ Filter 类型的宏定义'
        }, {
            'id':
            InjectPoint.F_NPC_CONSTANT_DEFINE,
            'desc':
            'npc.hpp @ npce_event 中 Filter 类型的 NPCF_XXX 常量定义'
        }, {
            'id':
            InjectPoint.F_NPC_GET_SCRIPT_EVENT,
            'desc':
            'npc.cpp @ npc_get_script_event_name 中 Filter 类型的变量和常量关联'
        }, {
            'id':
            InjectPoint.F_SCRIPT_EVENT_VAR_DEFINE,
            'desc':
            'script.hpp @ Script_Config 中 Filter 类型的 xxx_event_name 变量定义'
        }, {
            'id':
            InjectPoint.F_SCRIPT_EVNET_NAME_DEFINE,
            'desc':
            'script.cpp @ Script_Config 中 Filter 类型的事件名称定义'
        }, {
            'id':
            InjectPoint.F_SCRIPT_CONSTANTS_EXPORT,
            'desc':
            'script_constants.hpp 中 Filter 类型的 NPCF_XXX 常量导出定义'
        }, {
            'id': InjectPoint.F_NPC_FILTER_SETTING,
            'desc': 'npc.cpp 中 Filter 类型的 NPCF_XXX 常量设置'
        }, {
            'id': InjectPoint.E_PANDAS_SWITCH_DEFINE,
            'desc': 'pandas.hpp @ Event  类型的宏定义'
        }, {
            'id':
            InjectPoint.E_NPC_CONSTANT_DEFINE,
            'desc':
            'npc.hpp @ npce_event 中 Event  类型的 NPCE_XXX 常量定义'
        }, {
            'id':
            InjectPoint.E_NPC_GET_SCRIPT_EVENT,
            'desc':
            'npc.cpp @ npc_get_script_event_name 中 Event  类型的变量和常量关联'
        }, {
            'id':
            InjectPoint.E_SCRIPT_EVENT_VAR_DEFINE,
            'desc':
            'script.hpp @ Script_Config 中 Event  类型的 xxx_filter_name 变量定义'
        }, {
            'id':
            InjectPoint.E_SCRIPT_EVNET_NAME_DEFINE,
            'desc':
            'script.cpp @ Script_Config 中 Event  类型的事件名称定义'
        }, {
            'id':
            InjectPoint.E_SCRIPT_CONSTANTS_EXPORT,
            'desc':
            'script_constants.hpp 中 Event  类型的 NPCE_XXX 常量导出定义'
        }, {
            'id': InjectPoint.X_PANDAS_SWITCH_DEFINE,
            'desc': 'pandas.hpp @ Express 类型的宏定义'
        }, {
            'id':
            InjectPoint.X_NPC_CONSTANT_DEFINE,
            'desc':
            'npc.hpp @ npce_event 中 Express 类型的 NPCX_XXX 常量定义'
        }, {
            'id':
            InjectPoint.X_NPC_GET_SCRIPT_EVENT,
            'desc':
            'npc.cpp @ npc_get_script_event_name 中 Express 类型的变量和常量关联'
        }, {
            'id':
            InjectPoint.X_SCRIPT_EVENT_VAR_DEFINE,
            'desc':
            'script.hpp @ Script_Config 中 Express 类型的 xxx_express_name 变量定义'
        }, {
            'id':
            InjectPoint.X_SCRIPT_EVNET_NAME_DEFINE,
            'desc':
            'script.cpp @ Script_Config 中 Express 类型的事件名称定义'
        }, {
            'id':
            InjectPoint.X_SCRIPT_CONSTANTS_EXPORT,
            'desc':
            'script_constants.hpp 中 Express 类型的 NPCX_XXX 常量导出定义'
        }, {
            'id': InjectPoint.X_NPC_EXPRESS_SETTING,
            'desc': 'npc.cpp 中 Express 类型的 NPCX_XXX 常量设置'
        }]
    }

    guide(Injecter(options))
    Common.exit_with_pause()
コード例 #15
0
ファイル: dawn_symstore.py プロジェクト: CairoLee/Pandas
def main():
    # 加载 .env 中的配置信息
    load_dotenv(dotenv_path='.config.env', encoding='UTF-8')

    # 若无配置信息则自动复制一份文件出来
    if not Common.is_file_exists('.config.env'):
        shutil.copyfile('.config.env.sample', '.config.env')

    # 显示欢迎信息
    Common.welcome('符号归档辅助脚本')
    print('')

    # 由于 pdbparse 只能在 Windows 环境下安装, 此处进行限制
    if platform.system() != 'Windows':
        Message.ShowWarning('该脚本只能在 Windows 环境下运行, 程序终止.')
        Common.exit_with_pause(-1)

    # 若环境变量为空则设置个默认值
    if not os.getenv('DEFINE_PROJECT_NAME'):
        os.environ["DEFINE_PROJECT_NAME"] = "Pandas"

    if not os.getenv('DEFINE_SYMBOLS_SOURCE'):
        os.environ["DEFINE_SYMBOLS_SOURCE"] = "PandasWS/Pandas"

    if not os.getenv('DEFINE_COMPILE_MODE'):
        os.environ["DEFINE_COMPILE_MODE"] = "re,pre"

    # 符号仓库工程路径
    global project_symstoredir
    project_symstoredir = os.path.abspath(project_slndir + '../Symbols/' +
                                          os.getenv('DEFINE_PROJECT_NAME'))

    Message.ShowInfo('当前输出的项目名称为: %s' % os.getenv('DEFINE_PROJECT_NAME'))

    # 检查是否已经完成了编译
    if 're' in os.getenv('DEFINE_COMPILE_MODE').split(','):
        if not Common.is_compiled(project_slndir, checkmodel='re'):
            Message.ShowWarning('检测到打包需要的编译产物不完整, 请重新编译. 程序终止.')
            Common.exit_with_pause(-1)

    if 'pre' in os.getenv('DEFINE_COMPILE_MODE').split(','):
        if not Common.is_compiled(project_slndir, checkmodel='pre'):
            Message.ShowWarning('检测到打包需要的编译产物不完整, 请重新编译. 程序终止.')
            Common.exit_with_pause(-1)

    # 检查符号仓库是否存在, 不存在则创建
    if not ensure_store():
        Message.ShowWarning('你放弃了拉取符号仓库, 后续工作无法继续. 程序终止.')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('符号仓库已经存在于本地, 开始确认工作区状态...')

    # 若符号文件存在, 则确保工作区干净
    if not ensure_store_clean():
        Message.ShowWarning('为了防止出现意外, 请确保符号仓库的工作区是干净的. 程序终止.')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('很好, 符号仓库的工作区是干净的.')

    # 尝试更新本地的符号仓库到最新
    if not update_store():
        Message.ShowWarning('为了防止出现意外, 请确保符号仓库同步到最新. 程序终止.')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('符号仓库已经同步到最新, 开始归档新的符号文件...')

    # 搜索工程目录全部 pdb 文件和 exe 文件, 进行归档
    deploy_symbols(project_slndir)

    # 若环境变量为空则设置个默认值
    if not os.getenv('DEFINE_SYMBOLS_COMMIT'):
        os.environ["DEFINE_SYMBOLS_COMMIT"] = "3"

    commit_flag = int(os.getenv('DEFINE_SYMBOLS_COMMIT'))

    # 自动进行 git 提交操作
    if commit_flag & 1 == 1:
        if not Common.is_pandas_release(os.path.abspath(project_slndir)):
            Message.ShowStatus('符号文件已经归档完毕, 但并非正式版所以未自动提交...')
            Common.exit_with_pause()

    if commit_flag & 2 == 2:
        if Common.md5(os.getenv("DEFINE_CRASHRPT_APPID")
                      ) != '952648de2d8f063a07331ae3827bc406':
            Message.ShowStatus(
                '符号文件已经归档完毕, 但未设置熊猫模拟器官方正式版的崩溃上报 APPID, 所以并未自动提交...')
            Common.exit_with_pause()

    Message.ShowStatus('符号文件已经归档完毕, 正在提交...')
    if not make_commit():
        Message.ShowWarning('很抱歉, 提交失败! 请确认失败的原因. 程序终止.')
        Common.exit_with_pause(-1)
    else:
        Message.ShowStatus('提交成功, 请手工推送到远程仓库.')

    # 友好退出, 主要是在 Windows 环境里给予暂停
    Common.exit_with_pause()