aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside-tools
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2024-04-05 11:11:23 +0200
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2024-04-05 14:30:25 +0200
commit1396950daccded4b442c8a9d08aa10912a7641cf (patch)
tree24d2a64639046f87dc9ee9a5a0ac901cace2eed9 /sources/pyside-tools
parent5af78c7c420afebee05535130b059aa2809258b2 (diff)
Deployment: Adapt checking for plugin dependencies
- Check if package e.g. PySide6_AddOns is installed before checking for the .json file - If a package is missing, add log warning for the missing package. If the .json file is missing inspite of the package being installed, then raise a proper warning. Pick-to: 6.7 6.7.0 Task-number: PYSIDE-1612 Change-Id: Ia65b06df15df7b334438f439762b135d9f61981d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside-tools')
-rw-r--r--sources/pyside-tools/deploy_lib/config.py3
-rw-r--r--sources/pyside-tools/deploy_lib/dependency_util.py15
2 files changed, 14 insertions, 4 deletions
diff --git a/sources/pyside-tools/deploy_lib/config.py b/sources/pyside-tools/deploy_lib/config.py
index 2ca6ff895..d59dd92ad 100644
--- a/sources/pyside-tools/deploy_lib/config.py
+++ b/sources/pyside-tools/deploy_lib/config.py
@@ -391,7 +391,8 @@ class DesktopConfig(Config):
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)
+ self.qt_plugins = self.dependency_reader.find_plugin_dependencies(self.modules,
+ python_exe)
self._permissions = []
if sys.platform == "darwin":
diff --git a/sources/pyside-tools/deploy_lib/dependency_util.py b/sources/pyside-tools/deploy_lib/dependency_util.py
index d71640ed0..2d5b188d3 100644
--- a/sources/pyside-tools/deploy_lib/dependency_util.py
+++ b/sources/pyside-tools/deploy_lib/dependency_util.py
@@ -285,13 +285,22 @@ class QtDependencyReader:
else:
logging.info(f"[DEPLOY] No Qt dependencies found for {module}")
- def find_plugin_dependencies(self, used_modules: List[str]) -> List[str]:
+ def find_plugin_dependencies(self, used_modules: List[str], python_exe: Path) -> List[str]:
"""
Given the modules used by the application, returns all the required plugins
"""
plugins = set()
- pyside_mod_plugin_jsons = ["PySide6_Essentials.json", "PySide6_Addons.json"]
- for pyside_mod_plugin_json_name in pyside_mod_plugin_jsons:
+ pyside_wheels = ["PySide6_Essentials", "PySide6_Addons"]
+ # TODO from 3.12 use list(dist.name for dist in importlib.metadata.distributions())
+ _, installed_packages = run_command(command=[str(python_exe), "-m", "pip", "freeze"],
+ dry_run=False, fetch_output=True)
+ installed_packages = [p.decode().split('==')[0] for p in installed_packages.split()]
+ for pyside_wheel in pyside_wheels:
+ if pyside_wheel not in installed_packages:
+ # the wheel is not installed and hence no plugins are checked for its modules
+ logging.warning((f"[DEPLOY] The package {pyside_wheel} is not installed. "))
+ continue
+ pyside_mod_plugin_json_name = f"{pyside_wheel}.json"
pyside_mod_plugin_json_file = self.pyside_install_dir / pyside_mod_plugin_json_name
if not pyside_mod_plugin_json_file.exists():
warnings.warn(f"[DEPLOY] Unable to find {pyside_mod_plugin_json_file}.",