Exemplo n.º 1
0
def update_symstore():
    if not Common.is_dir_exists(project_symstoredir):
        print('')
        if not Inputer().requireBool({
            'tips' : '本机尚未克隆最新的符号仓库, 是否立刻进行克隆?',
            'default' : False
        }):
            Message.ShowStatus('您主动放弃了继续操作')
            Common.exit_with_pause(-1)

        git.Repo.clone_from(symbols_giturl, project_symstoredir)
    else:
        repo = git.Repo(project_symstoredir)
        if not repo.is_dirty() and not repo.untracked_files:
            Message.ShowStatus('正在尝试拉取最新的符号数据...')
            try:
                repo.remotes.origin.pull()
            except git.GitError as _err:
                Message.ShowWarning('符号数据更新失败: %s' % _err)
            else:
                Message.ShowStatus('符号数据更新成功.')
        else:
            print('')
            if Inputer().requireBool({
                'tips' : '本地符号仓库的工作区不干净, 是否重置工作区?',
                'default' : False
            }):
                repo.git.reset('--hard')
                repo.git.clean('-xdf')
                Message.ShowStatus('已成功重置本地符号仓库到干净状态.')
            else:
                Message.ShowWarning('本地符号仓库工作区不干净, 放弃更新符号数据..')
            print('')
Exemplo n.º 2
0
def compile_sub(define_val, name, version, scheme='Release|Win32'):
    '''
    用于执行编译
    '''
    # 获取第一个支持的 Visual Studio 对应的 vcvarsall 路径
    vcvarsall = get_vcvarsall_path()

    # 根据名称确定一下标记
    modetag = ('RE' if name == '复兴后' else 'PRE')

    # 执行编译
    Common.cmd_execute([
        '"%s" x86' % vcvarsall,
        'set CL=%s' % define_val, 'Devenv rAthena.sln /clean',
        'Devenv rAthena.sln /Rebuild "%s"' % scheme
    ], project_slndir, modetag, slndir(compile_logfile))

    # 编译完成后, 判断编译是否成功
    result, succ, faild, _skip = get_compile_result()
    if not result:
        Message.ShowError('无法获取 %s 的编译结果' % name)
        return False

    # 若成功, 则进行符号文件的存储
    if result and int(succ) > 1 and int(faild) == 0:
        return True
    else:
        Message.ShowWarning('%s: 存在编译失败的工程, 请进行检查...' % modetag)
        return False
Exemplo n.º 3
0
    def __searchMark(self, filename):
        line_num = 0
        charset = self.__detectCharset(filename)
        regex = r'\s*?' + self.__options__['mark_format'] + r'\s*?'

        if '../../src/'.replace('/', os.path.sep) in filename and charset.upper() != 'UTF-8-SIG':
            Message.ShowWarning('期望文件 %s 的编码为 UTF-8-SIG 而实际上是 %s' % (filename, charset.upper()))
            return

        try:
            textfile = open(filename, encoding=charset)
            for line in textfile:
                line_num = line_num + 1
                if '//' not in line:
                    continue

                re_match = re.match(regex, line)
                if not re_match:
                    continue

                if str(re_match.group(1)) in self.mark_dict:
                    Message.ShowError('发现重复的代码注入标记: ' + re_match.group(0))
                    Common.exit_with_pause(-1)

                self.mark_dict[re_match.group(1)] = {
                    'index' : int(re_match.group(1)),
                    'filepath' : filename,
                    'line' : line_num
                }
            textfile.close()
        except Exception as err:
            Message.ShowError('文件 : %s | 错误信息 : %s' % (filename, err))
Exemplo n.º 4
0
def make_commit():
    try:
        repo = git.Repo(project_symstoredir)

        if not repo.is_dirty() and not repo.untracked_files:
            Message.ShowWarning('工作区很干净, 没有任何变化文件, 无需提交.')
            return False

        repo.git.add('.')
        repo.git.commit('-m', '归档 Pandas {version} 版本的符号文件和编译产物, 代码源自 PandasWS/Pandas@{githash} 仓库'.format(
            version = Common.get_pandas_ver(project_slndir, 'v'),
            githash = Common.get_pandas_hash(project_slndir)
        ))
    except git.GitError as _err:
        Message.ShowWarning('提交失败, 原因: %s' % _err)
        return False
    else:
        return True
Exemplo n.º 5
0
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()
Exemplo n.º 6
0
def make_commit():
    try:
        repo = git.Repo(project_symstoredir)

        if not repo.is_dirty() and not repo.untracked_files:
            Message.ShowWarning('工作区很干净, 没有任何变化文件, 无需提交.')
            return False

        repo.git.add('.')
        repo.git.commit(
            '-m',
            '归档 {project_name} {version} 版本的符号文件和编译产物, 代码源自 {symbols_source}@{githash} 仓库'
            .format(project_name=os.getenv('DEFINE_PROJECT_NAME'),
                    symbols_source=os.getenv('DEFINE_SYMBOLS_SOURCE'),
                    version=Common.get_pandas_ver(project_slndir, 'v'),
                    githash=Common.get_pandas_hash(project_slndir)))
    except git.GitError as _err:
        Message.ShowWarning('提交失败, 原因: %s' % _err)
        return False
    else:
        return True
Exemplo n.º 7
0
def update_store():
    repo = git.Repo(project_symstoredir)
    if repo.is_dirty() or repo.untracked_files:
        return False
    
    Message.ShowStatus('正在尝试拉取最新的符号数据, 请稍候...')
    try:
        repo.remotes.origin.pull()
    except git.GitError as _err:
        Message.ShowWarning('更新失败, 原因: %s' % _err)
        return False
    else:
        return True
Exemplo n.º 8
0
def do_check_file(filename):
    '''
    检查给定的消息文件
    '''
    # 加载主要的消息文件
    Message.ShowStatus('正在加载 {filename} 的消息内容...'.format(
        filename=os.path.relpath(filename, project_slndir)))

    master = get_mes_dict(filename)

    # 递归寻找与他相关的 import 文件
    import_files = get_recursion_import_files(filename)

    Message.ShowStatus(
        '读取完毕, 找到约 {infocnt} 条消息信息, 额外引入了 {importcnt} 个消息文件.'.format(
            infocnt=len(master), importcnt=len(import_files)))

    # 分别加载这些文件的全部消息信息
    b_allfine = True
    for x in import_files:
        compare = get_mes_dict(os.path.abspath(project_slndir + x))

        # 若消息存在于主文件, 那么比对格式化标记
        for mesid in compare:
            if mesid not in master.keys():
                continue

            if not operator.eq(master[mesid]['fmt'], compare[mesid]['fmt']):
                b_allfine = False

                Message.ShowWarning(
                    '发现消息编号为: {mesid} 的格式化标记与主文件不一致!'.format(mesid=mesid))

                Message.ShowInfo('  主要 - {filename}: {mes}'.format(
                    filename=os.path.basename(filename),
                    mes=master[mesid]['mes']))

                Message.ShowInfo('  对比 - {filename}: {mes}'.format(
                    filename=os.path.basename(x), mes=compare[mesid]['mes']))

                print('')

    if b_allfine:
        Message.ShowStatus('检查完毕, 消息信息的格式化标记与主文件完全匹配!')

    print('')
Exemplo n.º 9
0
def ensure_store():
    if not Common.is_dir_exists(project_symstoredir):
        if not Inputer().requireBool({
                'tips': '本机尚未克隆最新的符号仓库, 是否立刻进行克隆?',
                'default': False
        }):
            return False

        # 若环境变量为空则设置个默认值
        if not os.getenv('DEFINE_REMOTE_SYMBOLS_URL'):
            os.environ[
                "DEFINE_REMOTE_SYMBOLS_URL"] = "https://github.com/PandasWS/Symbols.git"

        Message.ShowWarning('可能会抛出 UnicodeDecodeError 错误, 请无视即可.')

        try:
            git.Repo.clone_from(os.getenv('DEFINE_REMOTE_SYMBOLS_URL'),
                                project_symstoredir)
        except IndexError as _err:
            pass
    return True
Exemplo n.º 10
0
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()
Exemplo n.º 11
0
    def updateall(self, increase_version=True):
        '''
        更新全部翻译对照表文件, 并保留现有的翻译结果
        '''
        yamlfiles = glob.glob('../../conf/msg_conf/translation_*.yml')

        Message.ShowStatus('即将更新全部翻译对照表, 并保留现有的翻译结果...')
        if increase_version:
            Message.ShowInfo('对照表更新完成后会提升数据版本号.')
        else:
            Message.ShowWarning('本次对照表更新操作不会提升数据版本号.')
        for relpath in yamlfiles:
            fullpath = os.path.abspath(relpath)
            Message.ShowInfo('正在升级: %s' %
                             os.path.relpath(fullpath, project_slndir))
            _backup_body = self.body[:]
            self.updatefrom(fullpath, increase_version)
            if '_tw.yml' in relpath:
                for x in self.body:
                    x['Translation'] = self.__convert_backslash_step1(
                        x['Translation'])
            self.dump(fullpath)
            self.body = _backup_body
        Message.ShowStatus('感谢您的使用, 全部对照表翻译完毕.')
Exemplo n.º 12
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('编译流程辅助脚本')

    # 只能在 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()
Exemplo n.º 13
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('')

    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()
Exemplo n.º 14
0
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)
Exemplo n.º 15
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('')

    # 由于 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()