Files
guba-indicator/build.spec
xiaji 346d4a7c99 fix(打包): 改进打包脚本和Playwright浏览器路径处理
- 更新build.bat添加依赖检查和清理步骤
- 修改build.spec配置以正确处理Playwright依赖
- 增强SpiderManager中Playwright路径的查找逻辑
- 添加错误处理和调试信息
2026-01-20 15:11:03 +08:00

83 lines
1.7 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 -*-
import os
import sys
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
# 添加当前目录到路径
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
block_cipher = None
# 收集Playwright的数据文件
playwright_data = collect_data_files('playwright')
# 添加额外的隐藏导入
hiddenimports = [
'PySide6.Qt6Compat',
'loguru',
'playwright._impl._driver',
'playwright._impl._api_structures',
'playwright._impl._connection',
'playwright._impl._transport',
]
# 排除PyQt5避免冲突
excludes = ['PyQt5', 'PyQt6']
a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[
*playwright_data,
('guba.ico', '.'),
('indicator.ico', '.'),
('config.json', '.'),
],
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=excludes,
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
# 添加必要的二进制文件
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='guba-indicator',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False, # 不显示控制台窗口
icon='guba.ico',
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
# 如果需要单文件,使用以下配置
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='guba-indicator',
)