diff options
| author | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-10-14 17:07:11 +0200 |
|---|---|---|
| committer | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-10-15 09:32:42 +0000 |
| commit | a1df680b0f92fe70920cedbada8e9969a582f82b (patch) | |
| tree | d69170881c5bdae591a2ddf9431e228303c0a2f0 /sources/pyside-tools/deploy_lib/nuitka_helper.py | |
| parent | a5f3828c2c3580d673c9c4f466f71fc93af6966c (diff) | |
Deployment: Use include-data-dir
- Use --include-data-dir to include the QML modules. This would
reduce the command length significantly.
- Additionally, package all the subdirectories of the application
directory. The user may have other relevant resources required
by the application eg: images, fonts, etc.
- Add two new directories for directories to be ignored - docs and
examples. These directories are not required for the application
to run.
Pick-to: 6.8
Task-number: PYSIDE-1612
Change-Id: I6269f77c0fd94a54e3b7a44f317bc144bd68e5ec
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy_lib/nuitka_helper.py')
| -rw-r--r-- | sources/pyside-tools/deploy_lib/nuitka_helper.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sources/pyside-tools/deploy_lib/nuitka_helper.py b/sources/pyside-tools/deploy_lib/nuitka_helper.py index 2d46dcf8a..57b7d04ef 100644 --- a/sources/pyside-tools/deploy_lib/nuitka_helper.py +++ b/sources/pyside-tools/deploy_lib/nuitka_helper.py @@ -11,7 +11,7 @@ import shlex import sys from pathlib import Path -from . import MAJOR_VERSION, DesignStudio, run_command +from . import MAJOR_VERSION, DesignStudio, run_command, DEFAULT_IGNORE_DIRS from .config import DesktopConfig @@ -113,13 +113,26 @@ class Nuitka: extra_args.append(f"--include-data-dir={subdir}=" f"./{subdir.name}") else: + # include all the subdirectories in the project directory as data directories + # This includes all the qml modules + all_relevant_subdirs = [] + for subdir in source_file.parent.iterdir(): + if subdir.is_dir() and subdir.name not in DEFAULT_IGNORE_DIRS: + extra_args.append(f"--include-data-dir={subdir}=" + f"./{subdir.name}") + all_relevant_subdirs.append(subdir) + + # find all the qml files that are not included via the data directories + extra_qml_files = [file for file in qml_files + if file.parent not in all_relevant_subdirs] + # This will generate options for each file using: # --include-data-files=ABSOLUTE_PATH_TO_FILE=RELATIVE_PATH_TO ROOT - # for each file. This will preserve the directory structure of QML resources. + # for each file. qml_args.extend( [f"--include-data-files={qml_file.resolve()}=" f"./{qml_file.resolve().relative_to(source_file.resolve().parent)}" - for qml_file in qml_files] + for qml_file in extra_qml_files] ) # add qml plugin. The `qml`` plugin name is not present in the module json files shipped # with Qt and hence not in `qt_plugins``. However, Nuitka uses the 'qml' plugin name to |
