feat: Android improvements needed for building NumPy and related packages (#2695)

* Use auditwheel on Android

* Add auditwheel command to defaults

* pkgconfig fixes

* Pre-import ctypes before monkey-patching in _cross_venv

* Set PKG_CONFIG and PKG_CONFIG_RELOCATE_PATHS variables

* Initial attempt at using mzakharo/android-gfortran

* Switch to using termux/ndk-toolchain-clang-with-flang

* Move PKG_CONFIG variables from build_env to android_env

* Simplify flang installation

* Add cross build files for NumPy

* Add ldpaths entry for libomp

* Add `--rm` to docker command line

* Make Rust and Fortran shims consistent

* Update documentation

* Default to API level 24 on all Python versions

* Clarify comments

* Cleanups

* Fix tests:
* Set up Android env after installing pkgconf
* Add tests for successfully using an older API level
* Previous commit's auditwheel failure is fixed in the auditwheel PR

* Update how-it-works diagram

* Add tests for repair errors

* Add more repair tests

* Add test for Meson and Fortran

* Add test for cross build files

* Improve test_api_level error message

* Add xbuild-files option

* use pypa/auditwheel@main

* Remove dependencies which are no longer needed

* Fix README

* Update to auditwheel 6.7.0

* Fix compatibility with pkgconf 2.5.1.post2

* Documentation clarifications

Co-authored-by: Joe Rickerby <joerick@mac.com>

* Fortran shim improvements

* Add Jinja variables to new_meson_project

* Update run_example_ci_configs for changed new_meson_project signature

* Add missing dependency to run_example_ci_configs

---------

Co-authored-by: mayeut <mayeut@users.noreply.github.com>
Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
Malcolm Smith
2026-05-29 00:27:28 -04:00
committed by GitHub
co-authored by Joe Rickerby mayeut
parent e3e7cc9e07
commit 1cf64d0d3c
32 changed files with 775 additions and 246 deletions
+7 -6
View File
@@ -177,6 +177,7 @@ def expected_wheels(
musllinux_versions: list[str] | None = None,
macosx_deployment_target: str | None = None,
iphoneos_deployment_target: str | None = None,
android_api_level: int | None = None,
machine_arch: str | None = None,
platform: str | None = None,
python_abi_tags: list[str] | None = None,
@@ -201,6 +202,9 @@ def expected_wheels(
if iphoneos_deployment_target is None:
iphoneos_deployment_target = os.environ.get("IPHONEOS_DEPLOYMENT_TARGET", "13.0")
if android_api_level is None:
android_api_level = int(os.environ.get("ANDROID_API_LEVEL", "24"))
architectures = [machine_arch]
if not single_arch:
if platform == "linux" and full_auto:
@@ -226,6 +230,7 @@ def expected_wheels(
musllinux_versions=musllinux_versions,
macosx_deployment_target=macosx_deployment_target,
iphoneos_deployment_target=iphoneos_deployment_target,
android_api_level=android_api_level,
platform=platform,
python_abi_tags=python_abi_tags,
include_universal2=include_universal2,
@@ -242,6 +247,7 @@ def _expected_wheels(
musllinux_versions: list[str] | None,
macosx_deployment_target: str,
iphoneos_deployment_target: str,
android_api_level: int,
platform: str,
python_abi_tags: list[str] | None,
include_universal2: bool,
@@ -387,12 +393,7 @@ def _expected_wheels(
platform_tags.append(f"macosx_{min_macosx.replace('.', '_')}_universal2")
elif platform == "android":
api_level = {
"cp313-cp313": 21,
"cp314-cp314": 24,
"cp315-cp315": 24,
}[python_abi_tag]
platform_tags = [f"android_{api_level}_{machine_arch}"]
platform_tags = [f"android_{android_api_level}_{machine_arch}"]
elif platform == "ios":
if machine_arch == "x86_64":