aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShyamnath Premnadh <[email protected]>2024-05-31 14:12:48 +0200
committerShyamnath Premnadh <[email protected]>2024-06-14 10:54:36 +0200
commit7093016a138b79c335272d40ee7487bf19282541 (patch)
tree6d25656f654c5c0ec700f668e0c1315492757569
parent2d31f7becfa91d34d7199eba0ac0af6e5485af71 (diff)
Android Deployment: Enable pyside6-android-deploy in macOS
- enable the tool for macOS - add dependency .xml to the Android wheels Pick-to: 6.7 Task-number: PYSIDE-2766 Change-Id: I77495466b8a9cc3565c640beac202d533ee1d2a6 Reviewed-by: Friedemann Kleint <[email protected]>
-rw-r--r--build_scripts/config.py4
-rw-r--r--build_scripts/platforms/unix.py2
-rw-r--r--create_wheels.py4
-rw-r--r--sources/pyside-tools/deploy_lib/android/android_config.py7
-rw-r--r--sources/pyside-tools/deploy_lib/android/android_helper.py4
-rw-r--r--sources/pyside-tools/pyside_tool.py5
6 files changed, 17 insertions, 9 deletions
diff --git a/build_scripts/config.py b/build_scripts/config.py
index 4b1d755a1..bc5b05a05 100644
--- a/build_scripts/config.py
+++ b/build_scripts/config.py
@@ -204,9 +204,9 @@ class Config(object):
_pyside_tools = available_pyside_tools(qt_tools_path=qt_install_path)
# replacing pyside6-android_deploy by pyside6-android-deploy for consistency
- # Also, the tool should not exist in any other platform than Linux
+ # Also, the tool should not exist in any other platform than Linux and macOS
_console_scripts = []
- if ("android_deploy" in _pyside_tools) and sys.platform.startswith("linux"):
+ if ("android_deploy" in _pyside_tools) and sys.platform in ["linux", "darwin"]:
_console_scripts = [(f"{PYSIDE}-android-deploy ="
" PySide6.scripts.pyside_tool:android_deploy")]
_pyside_tools.remove("android_deploy")
diff --git a/build_scripts/platforms/unix.py b/build_scripts/platforms/unix.py
index 8378d42be..642b2c874 100644
--- a/build_scripts/platforms/unix.py
+++ b/build_scripts/platforms/unix.py
@@ -124,7 +124,7 @@ def prepare_packages_posix(pyside_build, _vars, cross_build=False):
script_dirs = ["qtpy2cpp_lib", "deploy_lib", "project"]
- if sys.platform.startswith("linux"):
+ if sys.platform in ["linux", "darwin"]:
scripts.append("android_deploy.py")
scripts.append("requirements-android.txt")
script_dirs.extend(["deploy_lib/android",
diff --git a/create_wheels.py b/create_wheels.py
index 063b59c45..c5d952fec 100644
--- a/create_wheels.py
+++ b/create_wheels.py
@@ -254,9 +254,9 @@ def wheel_pyside6_essentials(package_path: Path) -> Tuple[SetupData, List[Module
_pyside_tools = available_pyside_tools(packaged_qt_tools_path, package_for_wheels=True)
# replacing pyside6-android_deploy by pyside6-android-deploy for consistency
- # Also, the tool should not exist in any other platform than Linux
+ # Also, the tool should not exist in any other platform than Linux and macOS
_console_scripts = []
- if ("android_deploy" in _pyside_tools) and sys.platform.startswith("linux"):
+ if ("android_deploy" in _pyside_tools) and sys.platform in ("linux", "darwin"):
_console_scripts = ['pyside6-android-deploy = "PySide6.scripts.pyside_tool:android_deploy"']
_pyside_tools.remove("android_deploy")
diff --git a/sources/pyside-tools/deploy_lib/android/android_config.py b/sources/pyside-tools/deploy_lib/android/android_config.py
index ad818c2ff..151b606cb 100644
--- a/sources/pyside-tools/deploy_lib/android/android_config.py
+++ b/sources/pyside-tools/deploy_lib/android/android_config.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
import re
+import sys
import tempfile
import logging
import zipfile
@@ -15,6 +16,7 @@ from . import (extract_and_copy_jar, get_wheel_android_arch, find_lib_dependenci
from .. import (Config, find_pyside_modules, get_all_pyside_modules, MAJOR_VERSION)
ANDROID_NDK_VERSION = "26b"
+ANDROID_NDK_VERSION_NUMBER_SUFFIX = "10909125"
ANDROID_DEPLOY_CACHE = Path.home() / ".pyside6_android_deploy"
@@ -58,6 +60,11 @@ class AndroidConfig(Config):
else:
ndk_path_temp = (ANDROID_DEPLOY_CACHE / "android-ndk"
/ f"android-ndk-r{ANDROID_NDK_VERSION}")
+ if sys.platform == "darwin":
+ ndk_path_temp = (
+ ANDROID_DEPLOY_CACHE / "android-ndk"
+ / f"AndroidNDK{ANDROID_NDK_VERSION_NUMBER_SUFFIX}.app/Contents/NDK"
+ )
if ndk_path_temp.exists():
self.ndk_path = ndk_path_temp
diff --git a/sources/pyside-tools/deploy_lib/android/android_helper.py b/sources/pyside-tools/deploy_lib/android/android_helper.py
index 7d2f5d575..16c13a845 100644
--- a/sources/pyside-tools/deploy_lib/android/android_helper.py
+++ b/sources/pyside-tools/deploy_lib/android/android_helper.py
@@ -1,6 +1,6 @@
# 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 sys
import logging
import zipfile
from dataclasses import dataclass
@@ -91,7 +91,7 @@ def get_llvm_readobj(ndk_path: Path) -> Path:
'''
# TODO: Requires change if Windows platform supports Android Deployment or if we
# support host other than linux-x86_64
- return (ndk_path / "toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readobj")
+ return (ndk_path / f"toolchains/llvm/prebuilt/{sys.platform}-x86_64/bin/llvm-readobj")
def find_lib_dependencies(llvm_readobj: Path, lib_path: Path, used_dependencies: Set[str] = None,
diff --git a/sources/pyside-tools/pyside_tool.py b/sources/pyside-tools/pyside_tool.py
index b369be8a2..f68b3185e 100644
--- a/sources/pyside-tools/pyside_tool.py
+++ b/sources/pyside-tools/pyside_tool.py
@@ -214,8 +214,9 @@ def deploy():
def android_deploy():
- if not sys.platform == "linux":
- print("pyside6-android-deploy only works from a Linux host")
+ if sys.platform == "win32":
+ print("pyside6-android-deploy only works from a Unix host and not a Windows host",
+ file=sys.stderr)
else:
android_requirements_file = Path(__file__).parent / "requirements-android.txt"
with open(android_requirements_file, 'r', encoding='UTF-8') as file: