Files
cutThenThink/CutThenThink.spec
congsh 2d4cd9356e fix: 修复 Windows 打包问题
- 修复 build.bat: 添加 UTF-8 编码设置
- 修复 spec 文件: 移除不存在的 config.yaml.template
- 添加 README.md 作为数据文件

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

91 lines
1.8 KiB
Python
Raw Permalink 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=[
# 包含 README 作为说明
('README.md', '.'),
],
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',
)