diff --git a/scripts/pyinstaller/ileapp.spec b/scripts/pyinstaller/ileapp.spec index ed51cdda5..eb0a4bd86 100755 --- a/scripts/pyinstaller/ileapp.spec +++ b/scripts/pyinstaller/ileapp.spec @@ -1,49 +1,50 @@ -# -*- mode: python ; coding: utf-8 -*- - -block_cipher = None - -a = Analysis(['..\\..\\ileapp.py'], - pathex=['..\\scripts\\artifacts'], - binaries=[], - datas=[('..\\', '.\\scripts')], - hiddenimports=[ - 'astc_decomp_faster', - 'bencoding', - 'blackboxprotobuf', - 'Crypto.Cipher.AES', - 'ijson', - 'lib2to3.refactor', - 'liblzfse', - 'mdplist', - 'mmh3', - 'nska_deserialize', - 'pandas', - 'pgpy', - 'pillow_heif', - 'typedstream', - 'xml.etree.ElementTree', - ], - hookspath=['./'], - runtime_hooks=[], - excludes=[], - 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, - a.binaries, - a.zipfiles, - a.datas, - [], - name='ileapp', - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - upx_exclude=[], - runtime_tmpdir=None, - version='ileapp-file_version_info.txt', - console=True ) +# -*- mode: python ; coding: utf-8 -*- + +block_cipher = None + +a = Analysis(['..\\..\\ileapp.py'], + pathex=['..\\scripts\\artifacts', '..\\..'], + binaries=[], + datas=[('..\\', '.\\scripts'), ('..\\..\\assets', '.\\assets'), ('..\\..\\leapp_functions', '.\\leapp_functions')], + hiddenimports=[ + 'leapp_functions.parsers.apple_atx', + 'astc_decomp_faster', + 'bencoding', + 'blackboxprotobuf', + 'Crypto.Cipher.AES', + 'ijson', + 'lib2to3.refactor', + 'liblzfse', + 'mdplist', + 'mmh3', + 'nska_deserialize', + 'pandas', + 'pgpy', + 'pillow_heif', + 'typedstream', + 'xml.etree.ElementTree', + ], + hookspath=['./'], + runtime_hooks=[], + excludes=['scipy', 'matplotlib', 'pyarrow'], + 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, + a.binaries, + a.zipfiles, + a.datas, + [], + name='ileapp', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + version='ileapp-file_version_info.txt', + console=True ) diff --git a/scripts/pyinstaller/ileappGUI.spec b/scripts/pyinstaller/ileappGUI.spec index 56b88346f..d11d99181 100755 --- a/scripts/pyinstaller/ileappGUI.spec +++ b/scripts/pyinstaller/ileappGUI.spec @@ -1,50 +1,51 @@ -# -*- mode: python ; coding: utf-8 -*- - -block_cipher = None - -a = Analysis(['..\\..\\ileappGUI.py'], - pathex=['..\\scripts\\artifacts'], - binaries=[], - datas=[('..\\', '.\\scripts'), ('..\\..\\assets', '.\\assets')], - hiddenimports=[ - 'astc_decomp_faster', - 'bencoding', - 'blackboxprotobuf', - 'Crypto.Cipher.AES', - 'ijson', - 'lib2to3.refactor', - 'liblzfse', - 'mdplist', - 'mmh3', - 'nska_deserialize', - 'pandas', - 'pgpy', - 'pillow_heif', - 'typedstream', - 'xml.etree.ElementTree', - ], - runtime_hooks=[], - excludes=[], - 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, - a.binaries, - a.zipfiles, - a.datas, - [], - name='ileappGUI', - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - console=True, - hide_console='hide-early', - disable_windowed_traceback=False, - upx_exclude=[], - version='ileappGUI-file_version_info.txt', - runtime_tmpdir=None ) +# -*- mode: python ; coding: utf-8 -*- + +block_cipher = None + +a = Analysis(['..\\..\\ileappGUI.py'], + pathex=['..\\scripts\\artifacts', '..\\..'], + binaries=[], + datas=[('..\\', '.\\scripts'), ('..\\..\\assets', '.\\assets'), ('..\\..\\leapp_functions', '.\\leapp_functions')], + hiddenimports=[ + 'leapp_functions.parsers.apple_atx', + 'astc_decomp_faster', + 'bencoding', + 'blackboxprotobuf', + 'Crypto.Cipher.AES', + 'ijson', + 'lib2to3.refactor', + 'liblzfse', + 'mdplist', + 'mmh3', + 'nska_deserialize', + 'pandas', + 'pgpy', + 'pillow_heif', + 'typedstream', + 'xml.etree.ElementTree', + ], + runtime_hooks=[], + excludes=['scipy', 'matplotlib', 'pyarrow'], + 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, + a.binaries, + a.zipfiles, + a.datas, + [], + name='ileappGUI', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=True, + hide_console='hide-early', + disable_windowed_traceback=False, + upx_exclude=[], + version='ileappGUI-file_version_info.txt', + runtime_tmpdir=None ) diff --git a/scripts/pyinstaller/ileappGUI_Linux.spec b/scripts/pyinstaller/ileappGUI_Linux.spec index 4a399e40d..bf068902d 100755 --- a/scripts/pyinstaller/ileappGUI_Linux.spec +++ b/scripts/pyinstaller/ileappGUI_Linux.spec @@ -3,10 +3,11 @@ a = Analysis( ['../../ileappGUI.py'], - pathex=['../scripts/artifacts'], + pathex=['../scripts/artifacts', '../..'], binaries=[], - datas=[('../', 'scripts'), ('../../assets', 'assets')], + datas=[('../', 'scripts'), ('../../assets', 'assets'), ('../../leapp_functions', 'leapp_functions')], hiddenimports=[ + 'leapp_functions.parsers.apple_atx', 'astc_decomp_faster', 'bencoding', 'blackboxprotobuf', @@ -27,7 +28,7 @@ a = Analysis( hookspath=[], hooksconfig={}, runtime_hooks=[], - excludes=[], + excludes=['scipy', 'matplotlib', 'pyarrow'], noarchive=False, ) pyz = PYZ(a.pure) diff --git a/scripts/pyinstaller/ileappGUI_macOS.spec b/scripts/pyinstaller/ileappGUI_macOS.spec index 253dfdb23..8ba75aab7 100755 --- a/scripts/pyinstaller/ileappGUI_macOS.spec +++ b/scripts/pyinstaller/ileappGUI_macOS.spec @@ -3,10 +3,11 @@ a = Analysis( ['../../ileappGUI.py'], - pathex=['../scripts/artifacts'], + pathex=['../scripts/artifacts', '../..'], binaries=[], - datas=[('../', 'scripts'), ('../../assets', 'assets')], + datas=[('../', 'scripts'), ('../../assets', 'assets'), ('../../leapp_functions', 'leapp_functions')], hiddenimports=[ + 'leapp_functions.parsers.apple_atx', 'astc_decomp_faster', 'bencoding', 'blackboxprotobuf', @@ -26,7 +27,7 @@ a = Analysis( hookspath=[], hooksconfig={}, runtime_hooks=[], - excludes=[], + excludes=['scipy', 'matplotlib', 'pyarrow'], noarchive=False, ) pyz = PYZ(a.pure) diff --git a/scripts/pyinstaller/ileapp_Linux.spec b/scripts/pyinstaller/ileapp_Linux.spec index 179982d0e..c621fbc35 100755 --- a/scripts/pyinstaller/ileapp_Linux.spec +++ b/scripts/pyinstaller/ileapp_Linux.spec @@ -3,10 +3,11 @@ a = Analysis( ['../../ileapp.py'], - pathex=['../scripts/artifacts'], + pathex=['../scripts/artifacts', '../..'], binaries=[], - datas=[('../', 'scripts')], + datas=[('../', 'scripts'), ('../../assets', 'assets'), ('../../leapp_functions', 'leapp_functions')], hiddenimports=[ + 'leapp_functions.parsers.apple_atx', 'astc_decomp_faster', 'bencoding', 'blackboxprotobuf', @@ -26,7 +27,7 @@ a = Analysis( hookspath=[], hooksconfig={}, runtime_hooks=[], - excludes=[], + excludes=['scipy', 'matplotlib', 'pyarrow'], noarchive=False, ) pyz = PYZ(a.pure) diff --git a/scripts/pyinstaller/ileapp_macOS.spec b/scripts/pyinstaller/ileapp_macOS.spec index 582334140..4cf0c14f8 100644 --- a/scripts/pyinstaller/ileapp_macOS.spec +++ b/scripts/pyinstaller/ileapp_macOS.spec @@ -3,10 +3,11 @@ a = Analysis( ['../../ileapp.py'], - pathex=['../scripts/artifacts'], + pathex=['../scripts/artifacts', '../..'], binaries=[], - datas=[('../', 'scripts')], + datas=[('../', 'scripts'), ('../../assets', 'assets'), ('../../leapp_functions', 'leapp_functions')], hiddenimports=[ + 'leapp_functions.parsers.apple_atx', 'astc_decomp_faster', 'bencoding', 'blackboxprotobuf', @@ -26,7 +27,7 @@ a = Analysis( hookspath=[], hooksconfig={}, runtime_hooks=[], - excludes=[], + excludes=['scipy', 'matplotlib', 'pyarrow'], noarchive=False, ) pyz = PYZ(a.pure) diff --git a/scripts/report.py b/scripts/report.py index 24c6332af..03c9024e8 100644 --- a/scripts/report.py +++ b/scripts/report.py @@ -5,9 +5,18 @@ import html import os +import sys from pathlib import Path import shutil + +def _base_dir(): + """Directory holding bundled data (assets/, scripts/data/). In a PyInstaller + build this is sys._MEIPASS; running from source it is the cwd (repo root). + Resolving from here (not Path.cwd()) lets a packaged binary find its assets + no matter which directory it is launched from.""" + return Path(getattr(sys, "_MEIPASS", Path.cwd())) + from collections import OrderedDict from scripts.html_parts import nav_bar_script, nav_bar_script_footer, \ page_header, page_footer, body_start, body_end, body_sidebar_setup, body_sidebar_trailer, \ @@ -23,7 +32,7 @@ def get_tabler_icon_names(): """Returns a set of available tabler icon names by scanning the tabler_icons directory.""" - for _, dirs, files in Path.cwd().joinpath("assets/tabler_icons").walk(): + for _, dirs, files in _base_dir().joinpath("assets/tabler_icons").walk(): if '__pycache__' in dirs: dirs.remove('__pycache__') return set(file.replace('.svg', '') for file in files if file.endswith('.svg')) @@ -31,7 +40,7 @@ def get_tabler_icon_names(): def get_tabler_icon(icon_name): """Return the SVG contents for a Tabler icon by name.""" - return get_txt_file_content(Path.cwd().joinpath("assets/tabler_icons", f"{icon_name}.svg")) + return get_txt_file_content(_base_dir().joinpath("assets/tabler_icons", f"{icon_name}.svg")) def generate_report(reportfolderbase, time_in_secs, time_hms, extraction_type, image_input_path, @@ -42,8 +51,8 @@ def generate_report(reportfolderbase, time_in_secs, time_hms, extraction_type, i """ tabler_icon_names = get_tabler_icon_names() - tabler_icon_correction = get_json_file_content('scripts/data/tabler_icon_correction.json') - feather_to_tabler_icon_names = get_json_file_content('scripts/data/feather_to_tabler_icon_names.json') + tabler_icon_correction = get_json_file_content(str(_base_dir() / 'scripts/data/tabler_icon_correction.json')) + feather_to_tabler_icon_names = get_json_file_content(str(_base_dir() / 'scripts/data/feather_to_tabler_icon_names.json')) control = None side_heading = \