同步?
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['C:\\dev\\LLTQ\\ETL\\feiqiu-ETL\\etl_billiards\\gui\\main.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=[('C:\\dev\\LLTQ\\ETL\\feiqiu-ETL\\etl_billiards\\gui\\resources', 'gui/resources'), ('C:\\dev\\LLTQ\\ETL\\feiqiu-ETL\\etl_billiards\\database\\schema_dwd_doc.sql', 'database'), ('C:\\dev\\LLTQ\\ETL\\feiqiu-ETL\\etl_billiards\\database\\schema_dws.sql', 'database'), ('C:\\dev\\LLTQ\\ETL\\feiqiu-ETL\\etl_billiards\\database\\schema_etl_admin.sql', 'database'), ('C:\\dev\\LLTQ\\ETL\\feiqiu-ETL\\etl_billiards\\database\\schema_ODS_doc.sql', 'database'), ('C:\\dev\\LLTQ\\ETL\\feiqiu-ETL\\etl_billiards\\database\\seed_ods_tasks.sql', 'database'), ('C:\\dev\\LLTQ\\ETL\\feiqiu-ETL\\etl_billiards\\database\\seed_scheduler_tasks.sql', 'database')],
|
||||
hiddenimports=['PySide6.QtCore', 'PySide6.QtGui', 'PySide6.QtWidgets', 'psycopg2', 'psycopg2.extras', 'psycopg2.extensions', 'gui.models.task_model', 'gui.models.schedule_model', 'gui.utils.cli_builder', 'gui.utils.config_helper', 'gui.utils.app_settings', 'gui.workers.task_worker', 'gui.workers.db_worker', 'gui.widgets.settings_dialog'],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=['matplotlib', 'numpy', 'pandas', 'scipy', 'PIL', 'cv2', 'tkinter'],
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
[],
|
||||
exclude_binaries=True,
|
||||
name='ETL_Manager',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
console=False,
|
||||
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='ETL_Manager',
|
||||
)
|
||||
@@ -90,9 +90,11 @@ def build_exe(onefile: bool = False, console: bool = False):
|
||||
|
||||
# 隐式导入
|
||||
hidden_imports = [
|
||||
# PySide6 核心模块
|
||||
"PySide6.QtCore",
|
||||
"PySide6.QtGui",
|
||||
"PySide6.QtWidgets",
|
||||
# 数据库
|
||||
"psycopg2",
|
||||
"psycopg2.extras",
|
||||
"psycopg2.extensions",
|
||||
@@ -138,6 +140,9 @@ def build_exe(onefile: bool = False, console: bool = False):
|
||||
result = subprocess.run(cmd, cwd=str(project_root))
|
||||
|
||||
if result.returncode == 0:
|
||||
# 打包后精简:删除不需要的文件
|
||||
slim_dist(project_root / "dist" / "ETL_Manager" / "_internal")
|
||||
|
||||
print()
|
||||
print("=" * 50)
|
||||
print("打包成功!")
|
||||
@@ -149,6 +154,77 @@ def build_exe(onefile: bool = False, console: bool = False):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def slim_dist(internal_dir: Path):
|
||||
"""精简打包后的文件,删除不需要的内容"""
|
||||
if not internal_dir.exists():
|
||||
return
|
||||
|
||||
print()
|
||||
print("精简打包文件...")
|
||||
|
||||
removed_size = 0
|
||||
|
||||
# 1. 删除不需要的翻译文件(只保留中文和英文)
|
||||
translations_dir = internal_dir / "PySide6" / "translations"
|
||||
if translations_dir.exists():
|
||||
keep_langs = {"zh_CN", "zh_TW", "en"}
|
||||
for qm_file in translations_dir.glob("*.qm"):
|
||||
# 检查是否是需要保留的语言
|
||||
keep = False
|
||||
for lang in keep_langs:
|
||||
if lang in qm_file.name:
|
||||
keep = True
|
||||
break
|
||||
if not keep:
|
||||
size = qm_file.stat().st_size
|
||||
qm_file.unlink()
|
||||
removed_size += size
|
||||
|
||||
# 2. 删除 opengl32sw.dll(软件渲染,20MB,通常不需要)
|
||||
opengl_sw = internal_dir / "PySide6" / "opengl32sw.dll"
|
||||
if opengl_sw.exists():
|
||||
size = opengl_sw.stat().st_size
|
||||
opengl_sw.unlink()
|
||||
removed_size += size
|
||||
print(f" 删除: opengl32sw.dll ({size / 1024 / 1024:.1f} MB)")
|
||||
|
||||
# 3. 删除不需要的 Qt 模块 DLL(如果存在)
|
||||
unnecessary_dlls = [
|
||||
"Qt6Pdf.dll", # PDF 支持
|
||||
"Qt6Qml.dll", # QML 引擎
|
||||
"Qt6QmlMeta.dll",
|
||||
"Qt6QmlModels.dll",
|
||||
"Qt6QmlWorkerScript.dll",
|
||||
"Qt6Quick.dll", # Quick UI
|
||||
"Qt6VirtualKeyboard.dll", # 虚拟键盘
|
||||
]
|
||||
pyside6_dir = internal_dir / "PySide6"
|
||||
for dll_name in unnecessary_dlls:
|
||||
dll_path = pyside6_dir / dll_name
|
||||
if dll_path.exists():
|
||||
size = dll_path.stat().st_size
|
||||
dll_path.unlink()
|
||||
removed_size += size
|
||||
print(f" 删除: {dll_name} ({size / 1024 / 1024:.1f} MB)")
|
||||
|
||||
# 4. 删除不需要的插件目录
|
||||
unnecessary_plugins = [
|
||||
"networkinformation", # 网络信息
|
||||
"tls", # TLS 支持(数据库已有)
|
||||
]
|
||||
plugins_dir = pyside6_dir / "plugins"
|
||||
if plugins_dir.exists():
|
||||
for plugin_name in unnecessary_plugins:
|
||||
plugin_path = plugins_dir / plugin_name
|
||||
if plugin_path.exists():
|
||||
size = sum(f.stat().st_size for f in plugin_path.rglob("*") if f.is_file())
|
||||
shutil.rmtree(plugin_path)
|
||||
removed_size += size
|
||||
print(f" 删除插件: {plugin_name}")
|
||||
|
||||
print(f"共节省: {removed_size / 1024 / 1024:.1f} MB")
|
||||
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
import argparse
|
||||
|
||||
BIN
etl_billiards/dist/ETL_Manager/ETL_Manager.exe
vendored
BIN
etl_billiards/dist/ETL_Manager/ETL_Manager.exe
vendored
Binary file not shown.
BIN
etl_billiards/dist/ETL_Manager/_internal/LIBBZ2.dll
vendored
BIN
etl_billiards/dist/ETL_Manager/_internal/LIBBZ2.dll
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user