aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside-tools/deploy_lib/android/android_config.py
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2024-12-06 09:48:34 +0100
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2025-01-02 16:44:42 +0100
commitab8b330123cb557f66306b237f4c3aa8c0004f39 (patch)
tree9acae54ed4529e3c7b206c12befc071d178472a8 /sources/pyside-tools/deploy_lib/android/android_config.py
parenta067880f70c09f84bfeb24b4944c9e013c0fb93f (diff)
Android Deployment: Auto download Android NDK
- In order to prevent code duplication, a symlink to tools/cross_compile_android/android_utilities.py is created under sources/pyside-tools/deploy_lib/android. When running the script sources/pyside-tools/android_deploy.py, this works without any issues. When packaging the tools, the symlink is resolved into the actual file and the actual file is packaged into the wheels. - Remove global variable to __init__.py and remove the ones that are not used - Add tqdm to requirements.txt - Adapt tests - Additionally, include several new test cases to cover error scenarios more comprehensively Pick-to: 6.8 Task-number: PYSIDE-1612 Change-Id: I74728be30a2b8214b9a379b0b906fdacbb105833 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside-tools/deploy_lib/android/android_config.py')
-rw-r--r--sources/pyside-tools/deploy_lib/android/android_config.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/sources/pyside-tools/deploy_lib/android/android_config.py b/sources/pyside-tools/deploy_lib/android/android_config.py
index 503fa6085..6b9386b8a 100644
--- a/sources/pyside-tools/deploy_lib/android/android_config.py
+++ b/sources/pyside-tools/deploy_lib/android/android_config.py
@@ -12,12 +12,11 @@ from pathlib import Path
from pkginfo import Wheel
from . import (extract_and_copy_jar, get_wheel_android_arch, find_lib_dependencies,
- get_llvm_readobj, find_qtlibs_in_wheel, platform_map, create_recipe)
+ get_llvm_readobj, find_qtlibs_in_wheel, platform_map, create_recipe,
+ ANDROID_DEPLOY_CACHE)
from .. import (Config, get_all_pyside_modules, MAJOR_VERSION)
-
-ANDROID_NDK_VERSION = "26b"
-ANDROID_NDK_VERSION_NUMBER_SUFFIX = "10909125"
-ANDROID_DEPLOY_CACHE = Path.home() / ".pyside6_android_deploy"
+from .android_utilities import (ANDROID_NDK_VERSION, ANDROID_NDK_VERSION_NUMBER_SUFFIX,
+ download_android_ndk)
class AndroidConfig(Config):
@@ -52,7 +51,7 @@ class AndroidConfig(Config):
if android_data.ndk_path:
# from cli
self.ndk_path = android_data.ndk_path
- else:
+ elif not existing_config_file:
# from config
ndk_path_temp = self.get_value("buildozer", "ndk_path")
if ndk_path_temp:
@@ -67,12 +66,14 @@ class AndroidConfig(Config):
)
if ndk_path_temp.exists():
self.ndk_path = ndk_path_temp
+ else:
+ # download NDK
+ if not ANDROID_DEPLOY_CACHE.exists():
+ ANDROID_DEPLOY_CACHE.mkdir()
+ logging.info(f"Cache created at {str(ANDROID_DEPLOY_CACHE.resolve())}")
- if self.ndk_path:
- print(f"Using Android NDK: {str(self.ndk_path)}")
- else:
- raise FileNotFoundError("[DEPLOY] Unable to find Android NDK. Please pass the NDK "
- "path either from the CLI or from pysidedeploy.spec")
+ logging.info("[DEPLOY] Downloading Android NDK")
+ self.ndk_path = download_android_ndk(ANDROID_DEPLOY_CACHE)
self.sdk_path = None
if android_data.sdk_path: