# -*- mode: python ; coding: utf-8 -*- """ CutThenThink - Windows 打包配置 极简截图上传工具的 PyInstaller 配置 """ import sys from PyInstaller.building.build_main import Analysis, EXE, COLLECT, PYZ from PyInstaller.building.api import PKG # 项目信息 APP_NAME = 'CutThenThink' APP_VERSION = '2.0.0' # 分析配置 a = Analysis( ['src/main.py'], pathex=[], binaries=[], datas=[ # 包含配置文件模板 ('config.yaml.template', '.'), ], hiddenimports=[ 'PyQt6.QtCore', 'PyQt6.QtGui', 'PyQt6.QtWidgets', 'yaml', ], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[ # 排除测试相关 'test', 'tests', 'pytest', ], noarchive=False, optimize=0, ) # 打包配置 pyz = PYZ(a.pure, a.zipped_data, cipher=None) exe = EXE( pyz, a.scripts, a.binaries, a.datas, [], exclude_binaries=True, name=APP_NAME, debug=False, bootloader_ignore_signals=False, strip=False, upx=True, # 使用 UPX 压缩 upx_exclude=[], runtime_tmpdir=None, console=False, # 无控制台窗口 disable_windowed_traceback=False, argv_emulation=False, target_arch=None, codesign_identity=None, entitlements_file=None, icon=None, # TODO: 添加图标路径 ) # 收集所有文件 coll = COLLECT( exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, upx_exclude=[], name=APP_NAME, ) # 构建 MSI 安装包(Windows) pkg = PKG( coll, name=APP_NAME, version=APP_VERSION, description='极简截图上传工具', author='CutThenThink', keywords=['screenshot', 'upload', 'OCR'], license='MIT', )