diff options
| author | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-02-23 14:29:42 +0100 |
|---|---|---|
| committer | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-03-07 09:34:12 +0100 |
| commit | b8d29e0381235785f1726a8cc28b8b7579c32e03 (patch) | |
| tree | be9117a904fa7ec1e3713b442b8446a9f82802f0 /sources/pyside-tools/deploy_lib/config.py | |
| parent | 94c62891f9aa28c53f8c0a86904499ead4d52aad (diff) | |
Desktop Deployment: Optimize the plugins included
- Applications that use certain modules like Multimedia does not work
because the plugins for it were not included. However, including all
the plugins can make the application executable huge. This patch
filters out the necessary plugins by looking at
PySide6_Essentials.json and PySide6_Addons.json shipped with the
wheels and only bundles these necessary plugins with the application.
- Adjust tests.
Task-number: PYSIDE-1612
Task-number: PYSIDE-2597
Change-Id: I35c74907a1782ae5101fb7c0861adcb97db5792d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy_lib/config.py')
| -rw-r--r-- | sources/pyside-tools/deploy_lib/config.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/sources/pyside-tools/deploy_lib/config.py b/sources/pyside-tools/deploy_lib/config.py index 44b4ded06..f1c877cac 100644 --- a/sources/pyside-tools/deploy_lib/config.py +++ b/sources/pyside-tools/deploy_lib/config.py @@ -365,7 +365,7 @@ class DesktopConfig(Config): existing_config_file: bool = False, extra_ignore_dirs: List[str] = None): super().__init__(config_file, source_file, python_exe, dry_run, existing_config_file, extra_ignore_dirs) - + self.dependency_reader = QtDependencyReader(dry_run=self.dry_run) if self.get_value("qt", "modules"): self.modules = self.get_value("qt", "modules").split(",") else: @@ -373,20 +373,34 @@ class DesktopConfig(Config): self._find_and_set_qtquick_modules() self._find_dependent_qt_modules() + self._qt_plugins = [] + if self.get_value("qt", "plugins"): + self._qt_plugins = self.get_value("qt", "plugins").split(",") + else: + self.qt_plugins = self.dependency_reader.find_plugin_dependencies(self.modules) + + @property + def qt_plugins(self): + return self._qt_plugins + + @qt_plugins.setter + def qt_plugins(self, qt_plugins): + self._qt_plugins = qt_plugins + self.set_value("qt", "plugins", ",".join(qt_plugins)) + def _find_dependent_qt_modules(self): """ Given pysidedeploy_config.modules, find all the other dependent Qt modules. """ - dependency_reader = QtDependencyReader(dry_run=self.dry_run) all_modules = set(self.modules) - if not dependency_reader.lib_reader: - warnings.warn(f"[DEPLOY] Unable to find {dependency_reader.lib_reader_name}. This tool" - " helps to find the Qt module dependencies of the application. Skipping " - " checking for dependencies.", category=RuntimeWarning) + if not self.dependency_reader.lib_reader: + warnings.warn(f"[DEPLOY] Unable to find {self.dependency_reader.lib_reader_name}. This " + "tool helps to find the Qt module dependencies of the application. " + "Skipping checking for dependencies.", category=RuntimeWarning) return for module_name in self.modules: - dependency_reader.find_dependencies(module=module_name, used_modules=all_modules) + self.dependency_reader.find_dependencies(module=module_name, used_modules=all_modules) self.modules = list(all_modules) |
