Files
guba-indicator/build.spec
xiaji 10ce2ba17b feat(配置): 增加playwright_dir配置项并优化浏览器路径查找逻辑
添加playwright_dir配置项以支持自定义浏览器路径
优化打包环境和开发环境下的浏览器路径查找逻辑,优先使用配置中的路径
删除不再使用的build.bat打包脚本
2026-01-21 11:54:21 +08:00

84 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
# 添加当前目录到路径
current_dir = os.getcwd()
sys.path.append(current_dir)
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',
)