# Portable onedir bundle: no Mentor binaries, licenses or private projects. from pathlib import Path import sys import tomllib from PyInstaller.utils.win32.versioninfo import VSVersionInfo, FixedFileInfo, StringFileInfo, StringTable, StringStruct, VarFileInfo, VarStruct sys.path.insert(0, SPECPATH) from bundle_policy import filter_binaries root = Path(SPECPATH).parent version = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8"))["project"]["version"] assets = root / "src/mentor_pdf_export/assets" version_tuple = tuple(int(part) for part in version.split(".")) + (0,) version_info = VSVersionInfo( ffi=FixedFileInfo(filevers=version_tuple, prodvers=version_tuple, mask=0x3f, flags=0, OS=0x40004, fileType=1, subtype=0, date=(0, 0)), kids=[StringFileInfo([StringTable("040904B0", [ StringStruct("CompanyName", "simgreek"), StringStruct("FileDescription", "Mentor PDF Batch Exporter"), StringStruct("FileVersion", version), StringStruct("InternalName", "MentorPDFExporter"), StringStruct("OriginalFilename", "MentorPDFExporter.exe"), StringStruct("ProductName", "Mentor PDF Batch Exporter"), StringStruct("ProductVersion", version), StringStruct("LegalCopyright", "Copyright (c) 2026 simgreek"), ])]), VarFileInfo([VarStruct("Translation", [1033, 1200])])], ) analysis = Analysis( [str(root / "packaging" / "entrypoint.py")], pathex=[str(root / "src")], binaries=[], datas=[(str(assets), "mentor_pdf_export/assets")], hiddenimports=["win32job", "win32api", "win32con"], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=["PyQt5","PyQt6","PySide2","matplotlib","numpy","scipy","pandas","torch","tensorflow","IPython","pytest","pymupdf","fitz","tkinter"], noarchive=False, optimize=0, ) analysis.binaries = filter_binaries(analysis.binaries) pyz = PYZ(analysis.pure) exe = EXE(pyz, analysis.scripts, [], exclude_binaries=True, name="MentorPDFExporter", icon=str(assets / "app.ico"), version=version_info, debug=False, bootloader_ignore_signals=False, strip=False, upx=False, console=False, disable_windowed_traceback=False) coll = COLLECT(exe, analysis.binaries, analysis.datas, strip=False, upx=False, name=f"MentorPDFExporter-{version}")