Fix packaged builds: bundle leapp_functions & assets, resolve report assets when frozen#1646
Open
abrignoni wants to merge 1 commit into
Open
Fix packaged builds: bundle leapp_functions & assets, resolve report assets when frozen#1646abrignoni wants to merge 1 commit into
abrignoni wants to merge 1 commit into
Conversation
…assets from _MEIPASS PyInstaller CLI/GUI builds from main were broken: 1. leapp_functions not bundled. The apple_atx_images artifact imports leapp_functions.parsers.apple_atx; since artifacts load dynamically, PyInstaller never sees it, so the plugin loader crashed at startup with ModuleNotFoundError. Added leapp_functions to datas + a hidden import and put the repo root on pathex, on all six specs. 2. Report assets unreachable. report.py resolved assets/tabler_icons and scripts/data/*.json via Path.cwd(), which only works when run from the repo. A packaged binary launched elsewhere logged 'file not found' and produced a report with no icons. It now resolves from sys._MEIPASS when frozen. The CLI specs also did not bundle assets/ at all; added it (GUI specs already did). 3. Size. Excluded scipy, matplotlib and pyarrow (pulled in transitively via pandas but imported by zero iLEAPP files) to shrink the binaries. Verified: built the macOS CLI from ileapp_macOS.spec, loaded all 295 artifacts with no import error, and ran a full parse from an unrelated working directory with icons rendered and no missing-asset errors. The other five specs received the analogous change (not built here).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building the CLI from
scripts/pyinstaller/ileapp_macOS.specon currentmainproduces a broken binary. Two independent bugs, plus a size issue:1.
leapp_functionsis not bundled → plugin loader crashes on startupscripts/artifacts/apple_atx_images.pydoes:Artifacts are loaded dynamically (
plugin_loader.py), so PyInstaller's static analysis never seesleapp_functionsand doesn't bundle it. Running the packaged binary:This aborts the whole run (the loader imports every artifact at startup).
2. Report assets are resolved from
Path.cwd()→ no icons in a packaged binaryscripts/report.pyloads its Tabler icons and correction JSON with paths relative to the current working directory:That only works when iLEAPP is launched from the repo root. A packaged binary run from anywhere else logs:
and generates a report with missing icons. The three CLI specs also never bundled
assets/at all (the GUI specs already do).3. Size — unused heavy libs bundled
scipy,matplotlib, andpyarroware imported by zero iLEAPP files (they come in transitively viapandas). They add a lot to the binary for nothing.Fix
scripts/report.py— resolveassets/andscripts/data/fromsys._MEIPASSwhen frozen, falling back tocwdfrom source (no behavior change when run from source). New_base_dir()helper.ileapp[_macOS/_Linux].spec,ileappGUI[_macOS/_Linux].spec) — addleapp_functionstodatas+ a hidden import forleapp_functions.parsers.apple_atx, and put the repo root onpathexso analysis can find it.assets/(the GUI specs already did).scipy,matplotlib,pyarrowtoexcludes.Testing
Built the macOS CLI (
ileapp_macOS.spec) and verified end-to-end:apple_atx_images, with no import error.The other five specs received the analogous change but were not built in this environment (no Windows/Linux here). They share the identical gaps, so the same fix applies.