aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside-tools/deploy_lib/android/android_helper.py
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2023-09-21 16:38:49 +0200
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2023-10-02 16:09:50 +0200
commit0a1710429333001fbf5a96cdc9043f9ec2f559ba (patch)
tree6ef9cbb818c63deff81bb30b6f47680aace02c33 /sources/pyside-tools/deploy_lib/android/android_helper.py
parent0363a8799eaaa394defc8b509c4c1858584512b8 (diff)
Android Deployment: copy required plugins to libs
- Copy the required Qt plugins from `site_packages` of the python bundled with the application to the `libs` folder of the Android gradle project. Android looks for required libraries in this `libs` folder. A similar step is also done by `androiddeployqt` when it created an Android gradle project from a C++ application. - Dependent Qt libraries found during processing of pyside6-android-deploy are also copied into the `libs` folder, if it does not exist already. - `plugins` key added to `pysidedeploy.spec`, which represents the plugins to be copied. - The Android dependency files shipped with Qt for Android platforms, are prased to obtain all the dependent Qt plugins of an application. - Some code refactoring to facilitate the plugin and library copy, by passing the plugin and library names to the PySide6 recipe template. `jinja2` does the job of using this template to create the PySide6 recipe to be used by python-for-android. - As an addition, fix some minor code issues and add extra logging. Task-number: PYSIDE-1612 Pick-to: 6.6 Change-Id: I63ca1e48aa1e4c98c912a87e68f3ae912ce89ca4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy_lib/android/android_helper.py')
-rw-r--r--sources/pyside-tools/deploy_lib/android/android_helper.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/sources/pyside-tools/deploy_lib/android/android_helper.py b/sources/pyside-tools/deploy_lib/android/android_helper.py
index 3e74a7e79..c10bdd994 100644
--- a/sources/pyside-tools/deploy_lib/android/android_helper.py
+++ b/sources/pyside-tools/deploy_lib/android/android_helper.py
@@ -25,17 +25,31 @@ class AndroidData:
def create_recipe(version: str, component: str, wheel_path: str, generated_files_path: Path,
- qt_modules: List[str] = None):
+ qt_modules: List[str] = None, local_libs: List[str] = None,
+ plugins: List[str] = None):
'''
Create python_for_android recipe for PySide6 and shiboken6
'''
+ qt_plugins = []
+ if plugins:
+ #split plugins based on category
+ for plugin in plugins:
+ plugin_category, plugin_name = plugin.split('_', 1)
+ qt_plugins.append((plugin_category, plugin_name))
+
+ qt_local_libs = []
+ if local_libs:
+ qt_local_libs = [local_lib for local_lib in local_libs if local_lib.startswith("Qt6") ]
+
rcp_tmpl_path = Path(__file__).parent / "recipes" / f"{component}"
environment = Environment(loader=FileSystemLoader(rcp_tmpl_path))
template = environment.get_template("__init__.tmpl.py")
content = template.render(
version=version,
wheel_path=wheel_path,
- qt_modules=qt_modules
+ qt_modules=qt_modules,
+ qt_local_libs=qt_local_libs,
+ qt_plugins=qt_plugins
)
recipe_path = generated_files_path / "recipes" / f"{component}"