# -*- 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/app.ico'), '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' if (dsh_root / 'node_modules' / '@deepseek-ai' / 'dsh' / 'package.json').is_file(): 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(dsh_root / '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", ], excludes=[ "PySide6.QtDesigner", "PySide6.QtMultimedia", "PySide6.QtMultimediaWidgets", "PySide6.QtOpenGL", "PySide6.QtOpenGLWidgets", "PySide6.QtPdf", "PySide6.QtPdfWidgets", "PySide6.QtQml", "PySide6.QtQuick", "PySide6.QtQuickWidgets", "PySide6.QtWebChannel", ], 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", )