diff options
Diffstat (limited to 'sources/pyside-tools/deploy_lib/android')
3 files changed, 16 insertions, 11 deletions
diff --git a/sources/pyside-tools/deploy_lib/android/__init__.py b/sources/pyside-tools/deploy_lib/android/__init__.py index 80ba6dee3..27d4d7b60 100644 --- a/sources/pyside-tools/deploy_lib/android/__init__.py +++ b/sources/pyside-tools/deploy_lib/android/__init__.py @@ -1,6 +1,7 @@ # 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 from __future__ import annotations +from pathlib import Path # maps instruction set to Android platform names platform_map = {"aarch64": "arm64-v8a", @@ -11,6 +12,8 @@ platform_map = {"aarch64": "arm64-v8a", "armeabi-v7a": "armeabi-v7a", "x86": "x86"} +ANDROID_DEPLOY_CACHE = Path.home() / ".pyside6_android_deploy" + from .android_helper import (create_recipe, extract_and_copy_jar, get_wheel_android_arch, AndroidData, get_llvm_readobj, find_lib_dependencies, find_qtlibs_in_wheel) 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: diff --git a/sources/pyside-tools/deploy_lib/android/android_utilities.py b/sources/pyside-tools/deploy_lib/android/android_utilities.py new file mode 120000 index 000000000..d8a91b3e7 --- /dev/null +++ b/sources/pyside-tools/deploy_lib/android/android_utilities.py @@ -0,0 +1 @@ +../../../../tools/cross_compile_android/android_utilities.py
\ No newline at end of file |
