| 1 |
# -*- mode: python -*- |
| 2 |
import os |
| 3 |
from pathlib import Path |
| 4 |
import sys |
| 5 |
|
| 6 |
from PyInstaller.utils.hooks import copy_metadata |
| 7 |
|
| 8 |
from asammdf.gui.dialogs.dependencies_dlg import find_all_dependencies |
| 9 |
|
| 10 |
sys.setrecursionlimit(sys.getrecursionlimit() * 5) |
| 11 |
|
| 12 |
asammdf_path = Path.cwd() / "src" / "asammdf" / "app" / "asammdfgui.py" |
| 13 |
|
| 14 |
block_cipher = None |
| 15 |
added_files = [] |
| 16 |
|
| 17 |
# get metadata for importlib.metadata (used by DependenciesDlg) |
| 18 |
for dep in find_all_dependencies("asammdf"): |
| 19 |
added_files += copy_metadata(dep) |
| 20 |
|
| 21 |
for root, dirs, files in os.walk(asammdf_path.parent / "ui"): |
| 22 |
for file in files: |
| 23 |
if file.lower().endswith(("ui", "png", "qrc")): |
| 24 |
added_files.append((os.path.join(root, file), os.path.join("asammdf", "gui", "ui"))) |
| 25 |
|
| 26 |
import pyqtlet2 |
| 27 |
|
| 28 |
pyqtlet_path = Path(pyqtlet2.__path__[0]).resolve() |
| 29 |
site_packages = pyqtlet_path.parent |
| 30 |
site_packages_str = os.path.join(str(site_packages), "") |
| 31 |
for root, dirs, files in os.walk(pyqtlet_path): |
| 32 |
for file in files: |
| 33 |
if not file.lower().endswith(("py", "pyw")): |
| 34 |
file_name = os.path.join(root, file) |
| 35 |
dest = root.replace(site_packages_str, "") |
| 36 |
added_files.append((file_name, dest)) |
| 37 |
|
| 38 |
a = Analysis( |
| 39 |
[asammdf_path], |
| 40 |
pathex=[], |
| 41 |
binaries=[], |
| 42 |
datas=added_files, |
| 43 |
hiddenimports=[ |
| 44 |
"numpy.core._dtype_ctypes", |
| 45 |
"canmatrix.formats", |
| 46 |
"canmatrix.formats.dbc", |
| 47 |
"canmatrix.formats.arxml", |
| 48 |
"canmatrix.formats.ldf", |
| 49 |
"asammdf.blocks.cutils", |
| 50 |
"import pyqtgraph.canvas.CanvasTemplate_pyside6", |
| 51 |
"import pyqtgraph.canvas.TransformGuiTemplate_pyside6", |
| 52 |
"import pyqtgraph.console.template_pyside6", |
| 53 |
"import pyqtgraph.graphicsItems.PlotItem.plotConfigTemplate_pyside6", |
| 54 |
"import pyqtgraph.graphicsItems.ViewBox.axisCtrlTemplate_pyside6", |
| 55 |
"import pyqtgraph.GraphicsScene.exportDialogTemplate_pyside6", |
| 56 |
"import pyqtgraph.imageview.ImageViewTemplate_pyside6", |
| 57 |
], |
| 58 |
hookspath=[], |
| 59 |
runtime_hooks=[], |
| 60 |
excludes=[], |
| 61 |
win_no_prefer_redirects=False, |
| 62 |
win_private_assemblies=False, |
| 63 |
cipher=block_cipher, |
| 64 |
noarchive=False, |
| 65 |
) |
| 66 |
|
| 67 |
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) |
| 68 |
|
| 69 |
exe = EXE( |
| 70 |
pyz, |
| 71 |
a.scripts, |
| 72 |
[], |
| 73 |
name="asammdfgui", |
| 74 |
exclude_binaries=True, |
| 75 |
bootloader_ignore_signals=False, |
| 76 |
debug=False, |
| 77 |
strip=False, |
| 78 |
console=False, |
| 79 |
icon="asammdf.ico", |
| 80 |
) |
| 81 |
|
| 82 |
coll = COLLECT( |
| 83 |
exe, |
| 84 |
a.binaries, |
| 85 |
a.zipfiles, |
| 86 |
a.datas, |
| 87 |
Tree(asammdf_path.parent), |
| 88 |
upx=False, |
| 89 |
upx_exclude=[], |
| 90 |
name="asammdfgui", |
| 91 |
) |