From 42943d709f29754407b1e7c3b60e70417279f096 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 21 Oct 2024 11:24:32 +0800 Subject: [PATCH] Add support for macOS 11.0 as a target. --- README.rst | 12 ++++++------ osx_utils.sh | 6 ++++-- tests/test_osx_utils.sh | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index db078d30..67ab2166 100644 --- a/README.rst +++ b/README.rst @@ -181,17 +181,17 @@ shell scripts listed above are available for your build and test. Build options are controlled mainly by the following environment variables: -* ``MB_PYTHON_VER`` sets the Python version targeted: ``major.minor.patch`` +* ``MB_PYTHON_VERSION`` sets the Python version targeted: ``major.minor.patch`` for CPython, or ``pypy-major.minor`` for PyPy. -* ``MB_PYTHON_OSX_VER`` sets the minimum macOS SDK version for any C - extensions. For CPython targets it may be set to 10.6 or 10.9, provided a +* ``MB_PYTHON_OSX_VER`` sets the minimum macOS SDK version for any C extensions. + For CPython targets it may be set to 10.6, 10.9 or 11.0, provided a corresponding Python build is available at `python.org `_. It defaults to the highest version available. It's ignored for PyPy targets. * ``PLAT`` sets the architectures built for any C extensions: ``x86_64`` or - ``intel`` for 64-bit or 64/32-bit respectively. It defaults to the same - arches as the target Python version: 64-bit for CPython macOS 10.9 or PyPy, - and 64/32-bit for CPython 10.6. + ``intel`` for 64-bit or 64/32-bit respectively. It defaults to the same arches + as the target Python version: arm64 for macOS 11.0; x86_64 for CPython + macOS 10.9 or PyPy; and 64/32-bit for CPython 10.6. In most cases it's best to rely on the defaults for ``MB_PYTHON_OSX_VER`` and ``PLAT``, rather than setting them explicitly. Examples of exceptions to this diff --git a/osx_utils.sh b/osx_utils.sh index ecb9b8a9..07eeb01a 100644 --- a/osx_utils.sh +++ b/osx_utils.sh @@ -223,7 +223,7 @@ function get_macpython_osx_ver { } function macpython_arch_for_version { - # echo arch (intel or x86_64) that a version of Python is expected + # echo arch (intel, x86_64 or arm64) that a version of Python is expected # to be built for # Parameters # $py_ver Python version, in the format (major.minor.patch) for @@ -238,8 +238,10 @@ function macpython_arch_for_version { echo "intel" elif [[ "$py_osx_ver" == "10.9" ]]; then echo "x86_64" + elif [[ "$py_osx_ver" == "11.0" ]]; then + echo "arm64" else - echo "Unexpected CPython macOS version: ${py_osx_ver}, supported values: 10.6 and 10.9" + echo "Unexpected CPython macOS version: ${py_osx_ver}, supported values: 10.6, 10.9, 11.0" exit 1 fi else diff --git a/tests/test_osx_utils.sh b/tests/test_osx_utils.sh index 3e36bf4f..8fe019b5 100644 --- a/tests/test_osx_utils.sh +++ b/tests/test_osx_utils.sh @@ -32,6 +32,7 @@ [ "$(macpython_arch_for_version 2.7 10.6)" == "intel" ] || ingest [ "$(macpython_arch_for_version 2.7 10.9)" == "x86_64" ] || ingest [ "$(macpython_arch_for_version pypy-2.7)" == "x86_64" ] || ingest +[ "$(macpython_arch_for_version 3.10 11.0)" == "arm64" ] || ingest # test lookup of arch / min macOS versions from installed Python distutils tag [ "$(get_macpython_arch macosx-10.6-intel)" == "intel" ] || ingest