Files
dxdesigner-part-replacement/packaging/DxPartReplace.spec
T
阿白叔 5aeddacfc9
Core regression / Python core and release configuration (push) Successful in 17s
Core regression / JavaScript syntax (push) Successful in 3s
build: prepare V1.2.2 with portable 7-Zip self-extraction
2026-11-04 15:22:24 +08:00

138 lines
4.7 KiB
RPMSpec

# -*- mode: python ; coding: utf-8 -*-
"""PyInstaller definition for the automatic DxDesigner replacement tool."""
from pathlib import Path
import shutil
import win32com.client.gencache
project_root = Path(SPECPATH).parent
generated_root = project_root / "build" / "DxPartReplace-generated"
generated_root.mkdir(parents=True, exist_ok=True)
viewdraw_api = win32com.client.gencache.EnsureModule(
"{4ADEF4E1-690A-11CE-9261-0020C5E26659}", 0, 1, 0
)
if viewdraw_api is None:
raise RuntimeError("DxDesigner EE 7.9.5 type library is required for packaging")
shutil.copyfile(viewdraw_api.__file__, generated_root / "viewdraw_api.py")
legacy_runtime_datas = [
(
str(project_root / 'src/dx_productivity/trial_task_center/assets'),
'dx_productivity/trial_task_center/assets',
),
(
str(project_root / "integration" / "dxdesigner795" / "QuickPartReplace.vbs"),
"legacy-runtime/dxdesigner795",
),
(
str(project_root / "integration" / "dxdesigner795" / "NativeSnapshotReader.vbs"),
"legacy-runtime/dxdesigner795",
),
]
# The native assistant loads the official web UI; include its pinned Node runtime.
dsh_root = project_root / 'integration' / 'dsh'
for required in ('node_modules/@deepseek-ai/dsh/package.json', 'issue-bootstrap.json',
'start.mjs', 'package.json', 'task-plugin/host.mjs'):
if not (dsh_root / required).is_file():
raise RuntimeError(f'Complete DSH release runtime is required; missing: {required}')
if shutil.which('node') is None:
raise RuntimeError('Node executable is required for the complete release')
if (dsh_root / 'issue-bootstrap.json').is_file():
legacy_runtime_datas.append((str(dsh_root / 'issue-bootstrap.json'), 'dsh-runtime'))
if (dsh_root / 'node_modules' / '@deepseek-ai' / 'dsh' / 'package.json').is_file():
if not (dsh_root / 'issue-bootstrap.json').is_file():
raise RuntimeError('Provision the DSH issue-only reporter before packaging the native assistant.')
# Release distribution keeps the complete installed runtime, including
# lazily loaded packages, native binaries, frontend assets and metadata.
staged_node_modules = dsh_root / 'node_modules'
legacy_runtime_datas.extend([
(str(dsh_root / 'start.mjs'), 'dsh-runtime'),
(str(dsh_root / 'package.json'), 'dsh-runtime'),
(str(dsh_root / 'task-plugin'), 'dsh-runtime/task-plugin'),
(str(staged_node_modules), 'dsh-runtime/node_modules'),
(shutil.which('node'), 'dsh-runtime'),
(str(project_root / 'licenses' / 'DeepSeek-Harness-MIT.txt'), 'licenses'),
])
a = Analysis(
[str(project_root / "src" / "dx_productivity" / "trial_task_center" / "application.py")],
pathex=[str(project_root / "src"), str(generated_root)],
binaries=[],
datas=legacy_runtime_datas,
hiddenimports=[
"viewdraw_api",
"win32com.client",
"win32com.client.dynamic",
"win32con",
"win32gui",
"win32process",
# GetProcessTimes imports this from pywin32's C extension at runtime.
"win32timezone",
"pywinauto",
"pywinauto.controls.uiawrapper",
"PySide6.QtWebEngineCore",
"PySide6.QtWebEngineWidgets",
"PySide6.QtWebChannel",
"PySide6.QtQml",
"PySide6.QtQuick",
"PySide6.QtQuickWidgets",
"PySide6.QtOpenGL",
"PySide6.QtOpenGLWidgets",
],
excludes=[
"PySide6.QtDesigner",
"PySide6.QtMultimedia",
"PySide6.QtMultimediaWidgets",
"PySide6.QtPdf",
"PySide6.QtPdfWidgets",
],
noarchive=False,
)
excluded_qt_binaries = {
"icudt78.dll",
"icuuc.dll",
"qpdf.dll",
"qt6pdf.dll",
"qt6qml.dll",
"qt6qmlmeta.dll",
"qt6qmlmodels.dll",
"qt6qmlworkerscript.dll",
"qt6quick.dll",
}
if (dsh_root / 'node_modules' / '@deepseek-ai' / 'dsh' / 'package.json').is_file():
# WebEngineCore links Quick/QML/OpenGL/WebChannel even through its Widgets
# surface; dropping those DLLs breaks the embedded browser in a frozen app.
excluded_qt_binaries = {'qpdf.dll', 'qt6pdf.dll'}
a.binaries = [
entry
for entry in a.binaries
if Path(entry[0]).name.casefold() not in excluded_qt_binaries
]
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='DxPartReplace',
icon=str(project_root / 'src/dx_productivity/trial_task_center/assets/app.ico'),
version=str(project_root / 'packaging/windows-version-info.txt'),
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name="DxPartReplace",
)