feat: add support for building Android wheels (#2349)
* Add Android to resource files * Add Android to miscellaneous places * Add Android documentation * Docs cleanups * Add Android platform module; implement top-level structure and target Python installation * Implement setup_env and build_wheel * lru-dict build working * Alter prefix in sysconfigdata file; fix various issues with FLAGS variables * Implement Android testing * Add type annotations to _cross_venv * Revert Python 3.8 to pip 25.0.1 * Make test-sources required on Android * Add Android integration tests * Test cleanups * Add test of all available Python versions * Update test-sources and test-command behavior to match iOS * Documentation cleanups * Replace Builder class with a set of global functions * Rename "env" to "build_env" * Remove Chaquopy repository from default pip command line * Move native_platform to platforms module * Fix parse_config_settings Co-authored-by: Joe Rickerby <joerick@mac.com> * Add unit tests for parse_config_settings and arch_synonym * Make `shell_prepared` arguments keyword-only, and add tests for the commands that use it * Replace `importlib.util.spec_from_file_location` with `runpy.run_path` * Use python-build-standalone * Update Android Python * Enable KVM in Linux CI * Move KVM code to test_android.py * Use Java 17 on Azure * Install emulator if necessary before running -accel-check * Free up additional disk space on Linux runners * Add sudo * Skip emulator tests on CI platforms that don't support it * Download Android Python from Maven Central * Free up more disk space on Linux runners * fix: minor fixups Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * Set sysconfig._BASE_PREFIX to support sysconfig.get_path("include") * Get ANDROID_API_LEVEL from the build environment, not cibuildwheel's own environment * Correct relative path of test-sources * Pass a CMake toolchain file to the build * Add "repair" step which adds libc++ to the wheel when necessary * Add missing needs_emulator decorator * Provide useful error message if ANDROID_HOME is not set * Remove use of HOST environment variable * Update to Python 3.15.5 * Fix PyLint warnings, clarify comment * Group common arguments into a dataclass * Handle environment variables containing newlines * Discourage the use of `pytest` test commands without `python -m` * Use single quotes in user-visible messages * Improve testing documentation * Pass wheel filename to `log.build_end` * In GitHub Actions example, skip Android tests on macOS * Correct relative paths in `patchelf --set-rpath` * Clarify `test-sources` docs * Update to Python 3.13.5+20250722.214220 --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Joe Rickerby <joerick@mac.com> Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
co-authored by
Joe Rickerby
Henry Schreiner
parent
e2e24882d8
commit
0f487ee2cb
@@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
from cibuildwheel.__main__ import main
|
||||
from cibuildwheel.environment import ParsedEnvironment
|
||||
from cibuildwheel.frontend import _split_config_settings
|
||||
from cibuildwheel.frontend import _split_config_settings, parse_config_settings
|
||||
from cibuildwheel.options import BuildOptions, _get_pinned_container_images
|
||||
from cibuildwheel.selector import BuildSelector, EnableGroup
|
||||
from cibuildwheel.util import resources
|
||||
@@ -289,7 +289,9 @@ def test_build_verbosity(
|
||||
|
||||
@pytest.mark.parametrize("platform_specific", [False, True])
|
||||
def test_config_settings(platform_specific, platform, intercepted_build_args, monkeypatch):
|
||||
config_settings = 'setting=value setting=value2 other="something else"'
|
||||
config_settings = (
|
||||
'setting=value setting=value2 triplet=1 triplet=2 triplet=3 other="something else"'
|
||||
)
|
||||
if platform_specific:
|
||||
monkeypatch.setenv("CIBW_CONFIG_SETTINGS_" + platform.upper(), config_settings)
|
||||
monkeypatch.setenv("CIBW_CONFIG_SETTINGS", "a=b")
|
||||
@@ -304,8 +306,16 @@ def test_config_settings(platform_specific, platform, intercepted_build_args, mo
|
||||
assert _split_config_settings(config_settings) == [
|
||||
"-Csetting=value",
|
||||
"-Csetting=value2",
|
||||
"-Ctriplet=1",
|
||||
"-Ctriplet=2",
|
||||
"-Ctriplet=3",
|
||||
"-Cother=something else",
|
||||
]
|
||||
assert parse_config_settings(config_settings) == {
|
||||
"setting": ["value", "value2"],
|
||||
"triplet": ["1", "2", "3"],
|
||||
"other": "something else",
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -494,7 +504,8 @@ def test_defaults(platform, intercepted_build_args):
|
||||
if isinstance(repair_wheel_default, list):
|
||||
repair_wheel_default = " && ".join(repair_wheel_default)
|
||||
assert build_options.repair_command == repair_wheel_default
|
||||
assert build_options.build_frontend is None
|
||||
assert build_options.build_frontend.name == "build"
|
||||
assert build_options.build_frontend.args == ()
|
||||
|
||||
if platform == "linux":
|
||||
assert build_options.manylinux_images
|
||||
|
||||
Reference in New Issue
Block a user