From cd168efbe0c4557b64ac5483a286cb27aec8ddad Mon Sep 17 00:00:00 2001 From: Shyamnath Premnadh Date: Wed, 11 Oct 2023 12:49:00 +0200 Subject: Android Deployment: Filter module dependencies - An absolute 1:1 relation does not exist between Qt binaries and the generated PySide6 binaries eg: libQt6QmlModels.so exists and contains only QML types. Hence there are no Python bindings for it and QmlModels.abi3.so does not exist. - This patch cross checks the Qt module dependencies against available PySide6 modules and then decides if the dependency is a valid PySide6 module to be copied to the Android application `lib` folder and and also added to `libs.xml` to be loaded on application startup. - As an addition, 'isort' is ran on 'buildozer.py'. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: I40a6b747ee21a2eefadf557b81b5e1500b2d0a1e Reviewed-by: Friedemann Kleint --- sources/pyside-tools/deploy_lib/android/buildozer.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'sources/pyside-tools') diff --git a/sources/pyside-tools/deploy_lib/android/buildozer.py b/sources/pyside-tools/deploy_lib/android/buildozer.py index 3d187fa60..f66a4b01c 100644 --- a/sources/pyside-tools/deploy_lib/android/buildozer.py +++ b/sources/pyside-tools/deploy_lib/android/buildozer.py @@ -1,18 +1,24 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -import re import logging +import re import tempfile import xml.etree.ElementTree as ET +import zipfile +import PySide6 +from pathlib import Path from typing import List + from pkginfo import Wheel -import zipfile -from pathlib import Path +from .. import MAJOR_VERSION, BaseConfig, Config, run_command +from . import (create_recipe, find_lib_dependencies, find_qtlibs_in_wheel, + get_llvm_readobj) -from .. import run_command, BaseConfig, Config, MAJOR_VERSION -from . import get_llvm_readobj, find_lib_dependencies, find_qtlibs_in_wheel, create_recipe +# They all start with `Qt` as the prefix. Removing this prefix and getting the actual +# module name +ALL_PYSIDE_MODULES = [module[2:] for module in PySide6.__all__] class BuildozerConfig(BaseConfig): @@ -312,6 +318,9 @@ class BuildozerConfig(BaseConfig): if module not in pysidedeploy_config.modules: dependent_modules.add(module) + # check if the PySide6 binary for the Qt module actually exists + # eg: libQt6QmlModels.so exists and it includes QML types. Hence, it makes no + dependent_modules = [module for module in dependent_modules if module in ALL_PYSIDE_MODULES] dependent_modules_str = ",".join(dependent_modules) logging.info("[DEPLOY] The following extra dependencies were found:" f" {dependent_modules_str}") -- cgit v1.2.3