Files
cutThenThink/CutThenThink.spec
congsh 0ce1d71a90 build: 添加 Windows 打包方案
- 更新 PyInstaller spec 配置
- 简化 build.sh 构建脚本
- 更新 build.bat Windows 打包脚本
- 添加 docs/BUILD.md 打包说明文档

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 15:59:23 +08:00

91 lines
1.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- 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',
)