Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
aboutsummaryrefslogtreecommitdiffstats
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/android_deploy.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/android_deploy.py')
-rw-r--r--sources/pyside-tools/android_deploy.py27
1 files changed, 4 insertions, 23 deletions
diff --git a/sources/pyside-tools/android_deploy.py b/sources/pyside-tools/android_deploy.py
index fbc613069..3c1dd5925 100644
--- a/sources/pyside-tools/android_deploy.py
+++ b/sources/pyside-tools/android_deploy.py
@@ -8,11 +8,9 @@ import traceback
from pathlib import Path
from textwrap import dedent
-from pkginfo import Wheel
-
from deploy_lib import (setup_python, get_config, cleanup, install_python_dependencies,
config_option_exists, find_pyside_modules, MAJOR_VERSION)
-from deploy_lib.android import (create_recipe, extract_and_copy_jar, get_wheel_android_arch,
+from deploy_lib.android import (extract_and_copy_jar, get_wheel_android_arch,
Buildozer, AndroidData)
@@ -126,24 +124,8 @@ def main(name: str = None, pyside_wheel: Path = None, shiboken_wheel: Path = Non
f"the project {config.modules}")
config.modules.extend(extra_modules)
- # create recipes
- # https://python-for-android.readthedocs.io/en/latest/recipes/
- # These recipes are manually added through buildozer.spec file to be used by
- # python_for_android while building the distribution
- if not config.recipes_exist():
- logging.info("[DEPLOY] Creating p4a recipes for PySide6 and shiboken6")
- version = Wheel(config.wheel_pyside).version
- create_recipe(version=version, component=f"PySide{MAJOR_VERSION}",
- wheel_path=config.wheel_pyside,
- generated_files_path=generated_files_path,
- qt_modules=config.modules)
- create_recipe(version=version, component=f"shiboken{MAJOR_VERSION}",
- wheel_path=config.wheel_shiboken,
- generated_files_path=generated_files_path)
- config.recipe_dir = (generated_files_path / "recipes").resolve()
-
# extract out and copy .jar files to {generated_files_path}
- if not config.jars_dir or not Path(config.jars_dir).exists():
+ if not config.jars_dir or not Path(config.jars_dir).exists() and not dry_run:
logging.info("[DEPLOY] Extract and copy jar files from PySide6 wheel to "
f"{generated_files_path}")
extract_and_copy_jar(wheel_path=config.wheel_pyside,
@@ -154,9 +136,8 @@ def main(name: str = None, pyside_wheel: Path = None, shiboken_wheel: Path = Non
if not config.arch:
arch = get_wheel_android_arch(wheel=config.wheel_pyside)
if not arch:
- logging.exception("[DEPLOY] PySide wheel corrupted. Wheel name should end with"
+ raise RuntimeError("[DEPLOY] PySide wheel corrupted. Wheel name should end with"
"platform name")
- raise
config.arch = arch
# writing config file
@@ -174,7 +155,7 @@ def main(name: str = None, pyside_wheel: Path = None, shiboken_wheel: Path = Non
# init buildozer
Buildozer.dry_run = dry_run
logging.info("[DEPLOY] Creating buildozer.spec file")
- Buildozer.initialize(pysidedeploy_config=config)
+ Buildozer.initialize(pysidedeploy_config=config, generated_files_path=generated_files_path)
# run buildozer
logging.info("[DEPLOY] Running buildozer deployment")