fix build process: use absolute paths for icon folder in PyInstaller configuration to prevent runtime errors
This commit is contained in:
@@ -23,7 +23,9 @@ def build(build: bool = True, copy: bool = True, test: bool = False, dest: str |
|
|||||||
if test:
|
if test:
|
||||||
print("Building Windows test one-file bundle with PyInstaller")
|
print("Building Windows test one-file bundle with PyInstaller")
|
||||||
# On Windows use ';' as add-data separator (src;dest)
|
# On Windows use ';' as add-data separator (src;dest)
|
||||||
add_data_args = ["--add-data", "icon;icon"]
|
# Use absolute path for the icon folder so PyInstaller can find it
|
||||||
|
icon_src = str(project_root / "icon")
|
||||||
|
add_data_args = ["--add-data", f"{icon_src};icon"]
|
||||||
|
|
||||||
# Try to include dicognito package data (release_notes.md) which
|
# Try to include dicognito package data (release_notes.md) which
|
||||||
# PyInstaller may miss. This prevents runtime FileNotFoundError for
|
# PyInstaller may miss. This prevents runtime FileNotFoundError for
|
||||||
|
|||||||
+7
-2
@@ -1,11 +1,16 @@
|
|||||||
# -*- mode: python ; coding: utf-8 -*-
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
here = Path(__file__).resolve().parent
|
||||||
|
project_root = here
|
||||||
|
|
||||||
a = Analysis(
|
a = Analysis(
|
||||||
['nice.py'],
|
['nice.py'],
|
||||||
pathex=[],
|
pathex=[str(project_root)],
|
||||||
binaries=[],
|
binaries=[],
|
||||||
datas=[('icon', 'icon'), ('icon/icon1.png', 'icon')],
|
datas=[(str(project_root / 'icon'), 'icon'), (str(project_root / 'icon' / 'icon1.png'), 'icon')],
|
||||||
hiddenimports=['bs4', 'requests', 'nicegui', 'pynng'],
|
hiddenimports=['bs4', 'requests', 'nicegui', 'pynng'],
|
||||||
hookspath=[],
|
hookspath=[],
|
||||||
hooksconfig={},
|
hooksconfig={},
|
||||||
|
|||||||
Reference in New Issue
Block a user