132 lines
3.1 KiB
RPMSpec
132 lines
3.1 KiB
RPMSpec
# -*- mode: python ; coding: utf-8 -*-
|
|
"""PyInstaller onedir spec for Orisys Customer (Windows)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from PyInstaller.building.api import COLLECT, EXE, PYZ
|
|
from PyInstaller.building.build_main import Analysis
|
|
from PyInstaller.utils.hooks import collect_all, collect_data_files
|
|
|
|
SPEC_DIR = Path(SPECPATH).resolve()
|
|
REPO_ROOT = SPEC_DIR.parents[1]
|
|
BRANDING_DIR = REPO_ROOT / "shared" / "resources" / "branding"
|
|
ENTRY = SPEC_DIR / "entry.py"
|
|
|
|
|
|
def _branding_datas() -> list[tuple[str, str]]:
|
|
datas: list[tuple[str, str]] = []
|
|
if not BRANDING_DIR.is_dir():
|
|
return datas
|
|
for path in BRANDING_DIR.rglob("*"):
|
|
if path.is_file():
|
|
datas.append((str(path), "branding"))
|
|
return datas
|
|
|
|
|
|
block_cipher = None
|
|
|
|
# Config is copied beside the EXE by build.ps1 (writable / editable).
|
|
# Branding + package data go into _internal via Analysis datas.
|
|
datas = _branding_datas()
|
|
binaries: list = []
|
|
hiddenimports = [
|
|
"cv2",
|
|
"PyQt5.sip",
|
|
"pyqtgraph.graphicsItems",
|
|
"scipy.signal",
|
|
"numba",
|
|
]
|
|
datas += collect_data_files("orisys_app_shared", includes=["theme/*.json"])
|
|
try:
|
|
datas += collect_data_files("orisys")
|
|
except Exception:
|
|
pass
|
|
try:
|
|
cv2_datas, cv2_binaries, cv2_hidden = collect_all("cv2")
|
|
datas += cv2_datas
|
|
binaries += cv2_binaries
|
|
hiddenimports += list(cv2_hidden)
|
|
except Exception:
|
|
pass
|
|
|
|
icon_path = BRANDING_DIR / "logo.ico"
|
|
icon = str(icon_path) if icon_path.is_file() else None
|
|
|
|
a = Analysis(
|
|
[str(ENTRY)],
|
|
pathex=[
|
|
str(REPO_ROOT / "apps" / "customer" / "src"),
|
|
str(REPO_ROOT / "shared" / "src"),
|
|
],
|
|
binaries=binaries,
|
|
datas=datas,
|
|
hiddenimports=hiddenimports,
|
|
hookspath=[],
|
|
hooksconfig={},
|
|
runtime_hooks=[],
|
|
excludes=[
|
|
"open3d",
|
|
"orisys.finger.viewer",
|
|
"tkinter",
|
|
"matplotlib",
|
|
"IPython",
|
|
"jupyter",
|
|
"notebook",
|
|
"pytest",
|
|
"PyQt5.QtBluetooth",
|
|
"PyQt5.QtNfc",
|
|
"PyQt5.QtPositioning",
|
|
"PyQt5.QtLocation",
|
|
"PyQt5.QtMultimedia",
|
|
"PyQt5.QtMultimediaWidgets",
|
|
"PyQt5.QtSensors",
|
|
"PyQt5.QtSerialPort",
|
|
"PyQt5.QtWebChannel",
|
|
"PyQt5.QtWebEngine",
|
|
"PyQt5.QtWebEngineCore",
|
|
"PyQt5.QtWebEngineWidgets",
|
|
"PyQt5.QtWebSockets",
|
|
"PySide2",
|
|
"PySide6",
|
|
"PyQt6",
|
|
],
|
|
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,
|
|
[],
|
|
exclude_binaries=True,
|
|
name="OrisysCustomer",
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=False,
|
|
console=False,
|
|
disable_windowed_traceback=False,
|
|
argv_emulation=False,
|
|
target_arch=None,
|
|
codesign_identity=None,
|
|
entitlements_file=None,
|
|
icon=icon,
|
|
)
|
|
|
|
coll = COLLECT(
|
|
exe,
|
|
a.binaries,
|
|
a.zipfiles,
|
|
a.datas,
|
|
strip=False,
|
|
upx=False,
|
|
upx_exclude=[],
|
|
name="OrisysCustomer",
|
|
)
|