build.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:EMFT 作者: 132nd-etcher 项目源码 文件源码
def freeze(ctx, install: bool, force: bool):
    """
    Creates a Win32 executable file from EMFT's source
    """
    if install:
        _install_pyinstaller(ctx, force)

    pyinstaller_version, _, _ = do_ex(ctx, [sys.executable, '-m', 'PyInstaller', '--version'])
    pyinstaller_version = pyinstaller_version.strip()

    click.secho(f'current version of pyinstaller: {pyinstaller_version}', fg='green')
    # noinspection SpellCheckingInspection
    if not pyinstaller_version.strip() in (PYINSTALLER_NEEDED_VERSION, f'{PYINSTALLER_NEEDED_VERSION}0'):
        click.secho('EMFT needs a very specific version of PyInstaller to compile successfully.\n'
                    'You can force the installation of that version using the command:\n\n'
                    '\temft-build freeze --force', err=True, fg='red')
        exit(-1)

    do(ctx, [
        sys.executable,
        '-m', 'PyInstaller',
        '--log-level=WARN',
        '--noconfirm', '--onefile', '--clean', '--windowed',
        '--icon', './emft/resources/app.ico',
        '--workpath', './build',
        '--distpath', './dist',
        '--paths', f'{os.path.join(sys.exec_prefix, "Lib/site-packages/PyQt5/Qt/bin")}',
        '--add-data', f'{certifi.where()};.',
        '--name', 'EMFT',
        './emft/main.py'
    ])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号