From 42943d709f29754407b1e7c3b60e70417279f096 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 21 Oct 2024 11:24:32 +0800 Subject: [PATCH 01/22] 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 From c04666c5f0a6dbf7c5f8ec5b1a32d89703348298 Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 21 Oct 2024 17:38:57 +0300 Subject: [PATCH 02/22] add arm64 to test --- tests/test_common_utils.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_common_utils.sh b/tests/test_common_utils.sh index 57351deb..8fc97c5c 100644 --- a/tests/test_common_utils.sh +++ b/tests/test_common_utils.sh @@ -99,13 +99,12 @@ cmd_notexit good_cmd || ingest ! cmd_notexit bad_cmd || ingest ! cmd_notexit exit 1 || ingest -# On Linux docker containers in travis, can be x86_64, i686, s390x, ppc64le, or -# aarch64 [ "$(get_platform)" == x86_64 ] || \ [ "$(get_platform)" == i686 ] || \ [ "$(get_platform)" == aarch64 ] || \ [ "$(get_platform)" == ppc64le ] || \ [ "$(get_platform)" == s390x ] || \ + [ "$(get_platform)" == arm64 ] || \ exit 1 # Crudest possible check for get_distutils_platform From ac416287002ee3b2d8813885990a78f0b8c045ae Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 21 Oct 2024 17:57:35 +0300 Subject: [PATCH 03/22] arm64 always returns sdk 11.0 --- tests/test_osx_utils.sh | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/tests/test_osx_utils.sh b/tests/test_osx_utils.sh index 8fe019b5..0ab10a2a 100644 --- a/tests/test_osx_utils.sh +++ b/tests/test_osx_utils.sh @@ -46,26 +46,29 @@ [ "$(macpython_impl_for_version pypy-5.4)" == "pp" ] || ingest # Test lookup of available macOS SDK build targets from python version -[ "$(macpython_sdk_list_for_version 3.8)" == "10.9" ] || ingest -[ "$(macpython_sdk_list_for_version 3.7.5)" == "10.6 10.9" ] || ingest -[ "$(macpython_sdk_list_for_version 3.7)" == "10.6 10.9" ] || ingest -[ "$(macpython_sdk_list_for_version 3.6.5)" == "10.6 10.9" ] || ingest -[ "$(macpython_sdk_list_for_version 3.6)" == "10.6 10.9" ] || ingest -[ "$(macpython_sdk_list_for_version 3.5)" == "10.6" ] || ingest -[ "$(macpython_sdk_list_for_version 2.7)" == "10.9" ] || ingest -[ "$(macpython_sdk_list_for_version 2.7.14)" == "10.6" ] || ingest -[ "$(macpython_sdk_list_for_version 2.7.15)" == "10.6 10.9" ] || ingest -[ "$(macpython_sdk_list_for_version 2.7.17)" == "10.6 10.9" ] || ingest -[ "$(macpython_sdk_list_for_version 2.7.18)" == "10.9" ] || ingest - +if [ "$(uname -m)" != "arm64" ]; then + [ "$(macpython_sdk_list_for_version 3.8)" == "10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 3.7.5)" == "10.6 10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 3.7)" == "10.6 10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 3.6.5)" == "10.6 10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 3.6)" == "10.6 10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 3.5)" == "10.6" ] || ingest + [ "$(macpython_sdk_list_for_version 2.7)" == "10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 2.7.14)" == "10.6" ] || ingest + [ "$(macpython_sdk_list_for_version 2.7.15)" == "10.6 10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 2.7.17)" == "10.6 10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 2.7.18)" == "10.9" ] || ingest +fi (PLAT="arm64"; [ "$(macpython_sdk_for_version 3.9)" == "11.0" ] || ingest) (PLAT="universal2"; [ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest) (PLAT="x86_64"; [ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest) -[ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest -[ "$(macpython_sdk_for_version 3.8)" == "10.9" ] || ingest -[ "$(macpython_sdk_for_version 3.5)" == "10.6" ] || ingest -[ "$(macpython_sdk_for_version 2.7)" == "10.9" ] || ingest -[ "$(macpython_sdk_for_version 2.7.14)" == "10.6" ] || ingest +if [ "$(uname -m)" != "arm64" ]; then + [ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest + [ "$(macpython_sdk_for_version 3.8)" == "10.9" ] || ingest + [ "$(macpython_sdk_for_version 3.5)" == "10.6" ] || ingest + [ "$(macpython_sdk_for_version 2.7)" == "10.9" ] || ingest + [ "$(macpython_sdk_for_version 2.7.14)" == "10.6" ] || ingest +fi # Test pkg-config install install_pkg_config From f44d7b69bee51fd6194287b4b6a6d390fb867644 Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 21 Oct 2024 18:02:43 +0300 Subject: [PATCH 04/22] cross builds not supported on macos --- tests/test_osx_utils.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_osx_utils.sh b/tests/test_osx_utils.sh index 0ab10a2a..58952cf2 100644 --- a/tests/test_osx_utils.sh +++ b/tests/test_osx_utils.sh @@ -78,4 +78,6 @@ function echo_host_platform { } # Make sure `_PYTHON_HOST_PLATFORM` is set when building x86_64 thin wheel -(PLAT="x86_64"; MB_PYTHON_OSX_VER="10.9"; [ "$(wrap_wheel_builder echo_host_platform)" == "macosx-10.9-x86_64" ]) +if [ "$(uname -m)" != "arm64" ]; then + (PLAT="x86_64"; MB_PYTHON_OSX_VER="10.9"; [ "$(wrap_wheel_builder echo_host_platform)" == "macosx-10.9-x86_64" ]) +fi From 6fb59fca2ad676ae846547c1fe8af9df1a61cd5a Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 21 Oct 2024 18:43:52 +0300 Subject: [PATCH 05/22] update default openssl to 1.1.1w --- library_builders.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library_builders.sh b/library_builders.sh index cba1cbb6..186e7abf 100644 --- a/library_builders.sh +++ b/library_builders.sh @@ -43,9 +43,9 @@ FLEX_VERSION=${FLEX_VERSION:-2.6.4} BISON_VERSION=${BISON_VERSION:-3.0.4} FFTW_VERSION=${FFTW_VERSION:-3.3.7} CFITSIO_VERSION=${CFITSIO_VERSION:-3450} -OPENSSL_ROOT=${OPENSSL_ROOT:-openssl-1.1.1l} +OPENSSL_ROOT=${OPENSSL_ROOT:-openssl-1.1.1w} # Hash from https://www.openssl.org/source/openssl-1.1.1?.tar.gz.sha256 -OPENSSL_HASH=${OPENSSL_HASH:-0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1} +OPENSSL_HASH=${OPENSSL_HASH:-cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8} OPENSSL_DOWNLOAD_URL=${OPENSSL_DOWNLOAD_URL:-https://www.openssl.org/source} From 4c627677457c49ccce468f0dfb32a5028b8b3cb4 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 07:30:56 +0800 Subject: [PATCH 06/22] Fill out the macOS test matrix to differentiate x86_64 and ARM64 builds. --- .github/workflows/test.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df8d5666..39596751 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,15 +20,24 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] #, windows-latest] + os: [ubuntu-latest, macos-13, macos-latest ] #, windows-latest] python-version: ["3.13"] # ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"] + include: + # By default, specify an OSX_VER of 11.0, triggering ARM64 buildf. + - python-osx-ver: "11.0" + + # macos-13 is the last remaining x86-64 runner; + # set OSX_VER to 10.9 trigger x86_64 builds by default. + - os: macos-13 + python-osx-ver: "10.9" + # The type of runner that the job will run on runs-on: ${{ matrix.os }} env: MB_PYTHON_VERSION: 3.13 TEST_BUILDS: 1 - MB_PYTHON_OSX_VER: 10.9 + MB_PYTHON_OSX_VER: ${{ matrix.python-osx-ver }} ENV_VARS_PATH: "test/env_vars.sh" # Steps represent a sequence of tasks that will be executed as part of the job From 816305f377eff981d44ff52b8c4fe6910afe6727 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 10:04:02 +0800 Subject: [PATCH 07/22] Bump webp and hdf5 version to avoid compilation errors. --- library_builders.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/library_builders.sh b/library_builders.sh index 186e7abf..317ab731 100644 --- a/library_builders.sh +++ b/library_builders.sh @@ -22,11 +22,11 @@ JPEGTURBO_VERSION="${JPEGTURBO_VERSION:-2.1.3}" OPENJPEG_VERSION="${OPENJPEG_VERSION:-2.1}" LCMS2_VERSION="${LCMS2_VERSION:-2.9}" GIFLIB_VERSION="${GIFLIB_VERSION:-5.1.3}" -LIBWEBP_VERSION="${LIBWEBP_VERSION:-0.5.0}" +LIBWEBP_VERSION="${LIBWEBP_VERSION:-1.4.0}" XZ_VERSION="${XZ_VERSION:-5.2.2}" LIBYAML_VERSION="${LIBYAML_VERSION:-0.2.2}" SZIP_VERSION="${SZIP_VERSION:-2.1.1}" -HDF5_VERSION="${HDF5_VERSION:-1.10.5}" +HDF5_VERSION="${HDF5_VERSION:-1.14.5}" LIBAEC_VERSION="${LIBAEC_VERSION:-1.0.4}" LZO_VERSION=${LZO_VERSION:-2.10} LZF_VERSION="${LZF_VERSION:-3.6}" @@ -311,9 +311,10 @@ function build_hdf5 { build_zlib # libaec is a drop-in replacement for szip build_libaec - local hdf5_url=https://support.hdfgroup.org/ftp/HDF5/releases - local short=$(echo $HDF5_VERSION | awk -F "." '{printf "%d.%d", $1, $2}') - fetch_unpack $hdf5_url/hdf5-$short/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz + local hdf5_url=https://support.hdfgroup.org/releases/hdf5 + local short=$(echo $HDF5_VERSION | awk -F "." '{printf "v%d_%d", $1, $2}') + local long=$(echo $HDF5_VERSION | awk -F "." '{printf "v%d_%d_%d", $1, $2, $3}') + fetch_unpack $hdf5_url/$short/$long/downloads/hdf5-$HDF5_VERSION.tar.gz (cd hdf5-$HDF5_VERSION \ && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BUILD_PREFIX/lib \ && ./configure --with-szlib=$BUILD_PREFIX --prefix=$BUILD_PREFIX \ From 5221ae95a2cd200d939d506987efa032bc7f30f4 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 12:09:42 +0800 Subject: [PATCH 08/22] Correct the python version test. --- tests/test_python_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_python_install.sh b/tests/test_python_install.sh index 58f8f761..8d3df5e2 100644 --- a/tests/test_python_install.sh +++ b/tests/test_python_install.sh @@ -20,7 +20,7 @@ then # CPython/PyPy version implementer_version=${BASH_REMATCH[2]:-$cpython_version} fi -python_mm="${cpython_version:0:1}.${cpython_version:2:1}" +python_mm=$(echo $cpython_version | awk -F "." '{printf "%d.%d", $1, $2}') # extract implementation prefix and version if [[ "$MB_PYTHON_VERSION" =~ (pypy[0-9\.]*-)?([0-9\.]+) ]]; then From 09dcce564c8621094efeeddc6425213fc74c0d9a Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 12:12:28 +0800 Subject: [PATCH 09/22] Correct typo Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39596751..ef16589a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: python-version: ["3.13"] # ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"] include: - # By default, specify an OSX_VER of 11.0, triggering ARM64 buildf. + # By default, specify an OSX_VER of 11.0, triggering ARM64 build. - python-osx-ver: "11.0" # macos-13 is the last remaining x86-64 runner; From b12a0b4ccdb0a6a1255e4f7a9334918e622deadb Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 12:37:13 +0800 Subject: [PATCH 10/22] Remove platform test that doesn't make sense any more. --- tests/test_python_install.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/test_python_install.sh b/tests/test_python_install.sh index 8d3df5e2..ef3da366 100644 --- a/tests/test_python_install.sh +++ b/tests/test_python_install.sh @@ -70,13 +70,3 @@ else # not virtualenv ingest "Wrong macpython or pypy pip '$PIP_CMD'" fi fi - -# check macOS version and arch are as expected -distutils_plat=$($PYTHON_EXE -c "import distutils.util; print(distutils.util.get_platform())") -expected_arch=$(macpython_arch_for_version $MB_PYTHON_VERSION) -if [[ $requested_impl == 'cp' ]]; then - expected_tag="macosx-$MB_PYTHON_OSX_VER-$expected_arch" -else - expected_tag="macosx-10.[0-9]+-$expected_arch" -fi -[[ $distutils_plat =~ $expected_tag ]] || ingest From e420d83351e7293bf36fc88685bc5a1f42e5f38a Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 13:46:59 +0800 Subject: [PATCH 11/22] More tweaks to arm64 macOS tests. --- osx_utils.sh | 9 +++++---- tests/test_osx_utils.sh | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/osx_utils.sh b/osx_utils.sh index 07eeb01a..403a04d5 100644 --- a/osx_utils.sh +++ b/osx_utils.sh @@ -114,14 +114,14 @@ function macpython_sdk_list_for_version { local _major=${_ver%%.*} local _return - if [ "$(uname -m)" = "arm64" ]; then - _return="11.0" - elif [ "$_major" -eq "2" ]; then + if [ "$_major" -eq "2" ]; then [ $(lex_ver $_ver) -lt $(lex_ver 2.7.18) ] && _return="10.6" [ $(lex_ver $_ver) -ge $(lex_ver 2.7.15) ] && _return="$_return 10.9" elif [ "$_major" -eq "3" ]; then [ $(lex_ver $_ver) -lt $(lex_ver 3.8) ] && _return="10.6" [ $(lex_ver $_ver) -ge $(lex_ver 3.6.5) ] && _return="$_return 10.9" + [ $(lex_ver $_ver) -ge $(lex_ver 3.9.1) ] && _return="$_return 11.0" + [ $(lex_ver $_ver) -ge $(lex_ver 3.10.0) ] && _return="11.0" else echo "Error version=${_ver}, expecting 2.x or 3.x" 1>&2 exit 1 @@ -174,7 +174,8 @@ function pyinst_fname_for_version { # creates intel only wheels by default. When PLAT=universal2 # we set the env variable _PYTHON_HOST_PLATFORM to change this # default. - if [ "$(uname -m)" == "arm64" ] || [ $(lex_ver $py_version) -ge $(lex_ver 3.10.0) ]; then + if [ "$(uname -m)" == "arm64" ] && [ $(lex_ver $py_version) -ge $(lex_ver 3.9.0) ] \ + || [ $(lex_ver $py_version) -ge $(lex_ver 3.10.0) ]; then if [ "$py_version" == "3.9.1" ]; then echo "python-${py_version}-macos11.0.${inst_ext}" else diff --git a/tests/test_osx_utils.sh b/tests/test_osx_utils.sh index 58952cf2..367a7d8e 100644 --- a/tests/test_osx_utils.sh +++ b/tests/test_osx_utils.sh @@ -14,6 +14,8 @@ [ "$(pyinst_fname_for_version 3.6.8)" == "python-3.6.8-macosx10.9.pkg" ] || ingest [ "$(pyinst_fname_for_version 3.7.1)" == "python-3.7.1-macosx10.9.pkg" ] || ingest [ "$(pyinst_fname_for_version 3.8.0)" == "python-3.8.0-macosx10.9.pkg" ] || ingest +[ "$(pyinst_fname_for_version 3.9.3)" == "python-3.9.3-macosx11.pkg" ] || ingest +[ "$(pyinst_fname_for_version 3.11.3)" == "python-3.11.3-macosx11.pkg" ] || ingest [ "$(pyinst_fname_for_version 2.7.14 10.6)" == "python-2.7.14-macosx10.6.pkg" ] || ingest [ "$(pyinst_fname_for_version 2.7.15 10.6)" == "python-2.7.15-macosx10.6.pkg" ] || ingest @@ -25,8 +27,8 @@ # Test utilities for getting Python version versions [ "$(get_py_digit)" == "${cpython_version:0:1}" ] || ingest -[ "$(get_py_mm)" == "${cpython_version:0:3}" ] || ingest -[ "$(get_py_mm_nodot)" == $(echo "${cpython_version:0:3}" | tr -d .) ] || ingest +[ "$(get_py_mm)" == "$(echo $cpython_version | awk -F "." '{printf "%d.%d", $1, $2}')" ] || ingest +[ "$(get_py_mm_nodot)" == $(echo "$(echo $cpython_version | awk -F "." '{printf "%d%d", $1, $2}')" | tr -d .) ] || ingest # test lookup of arch from Python macOS target build [ "$(macpython_arch_for_version 2.7 10.6)" == "intel" ] || ingest @@ -47,6 +49,8 @@ # Test lookup of available macOS SDK build targets from python version if [ "$(uname -m)" != "arm64" ]; then + [ "$(macpython_sdk_list_for_version 3.11.3)" == "11.0" ] || ingest + [ "$(macpython_sdk_list_for_version 3.9.3)" == "10.9 11.0" ] || ingest [ "$(macpython_sdk_list_for_version 3.8)" == "10.9" ] || ingest [ "$(macpython_sdk_list_for_version 3.7.5)" == "10.6 10.9" ] || ingest [ "$(macpython_sdk_list_for_version 3.7)" == "10.6 10.9" ] || ingest @@ -59,8 +63,13 @@ if [ "$(uname -m)" != "arm64" ]; then [ "$(macpython_sdk_list_for_version 2.7.17)" == "10.6 10.9" ] || ingest [ "$(macpython_sdk_list_for_version 2.7.18)" == "10.9" ] || ingest fi + +(PLAT="arm64"; [ "$(macpython_sdk_for_version 3.11)" == "11.0" ] || ingest) +(PLAT="universal2"; [ "$(macpython_sdk_for_version 3.11)" == "11.0" ] || ingest) +(PLAT="x86_64"; [ "$(macpython_sdk_for_version 3.11)" == "11.0" ] || ingest) + (PLAT="arm64"; [ "$(macpython_sdk_for_version 3.9)" == "11.0" ] || ingest) -(PLAT="universal2"; [ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest) +(PLAT="universal2"; [ "$(macpython_sdk_for_version 3.9)" == "11.0" ] || ingest) (PLAT="x86_64"; [ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest) if [ "$(uname -m)" != "arm64" ]; then [ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest From 915f9c79860d5aa3a605fef26679c4938b8503a9 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 14:49:06 +0800 Subject: [PATCH 12/22] Rework macOS sdk and filename handling. --- osx_utils.sh | 25 +++++++------ tests/test_osx_utils.sh | 77 +++++++++++++++++++++++++++-------------- 2 files changed, 65 insertions(+), 37 deletions(-) diff --git a/osx_utils.sh b/osx_utils.sh index 403a04d5..de8fae9e 100644 --- a/osx_utils.sh +++ b/osx_utils.sh @@ -120,8 +120,10 @@ function macpython_sdk_list_for_version { elif [ "$_major" -eq "3" ]; then [ $(lex_ver $_ver) -lt $(lex_ver 3.8) ] && _return="10.6" [ $(lex_ver $_ver) -ge $(lex_ver 3.6.5) ] && _return="$_return 10.9" - [ $(lex_ver $_ver) -ge $(lex_ver 3.9.1) ] && _return="$_return 11.0" - [ $(lex_ver $_ver) -ge $(lex_ver 3.10.0) ] && _return="11.0" + if [ "$(uname -m)" == "arm64" ]; then + [ $(lex_ver $_ver) -ge $(lex_ver 3.8.10) ] && [ "$_ver" != "3.9.0" ] && _return="$_return 11.0" + fi + [ $(lex_ver $_ver) -ge $(lex_ver 3.10.0) ] && _return="11.0" else echo "Error version=${_ver}, expecting 2.x or 3.x" 1>&2 exit 1 @@ -167,23 +169,24 @@ function pyinst_fname_for_version { # this from $py_version using macpython_sdk_for_version local py_version=$1 local inst_ext=$(pyinst_ext_for_version $py_version) - # Use the universal2 installer if we are on arm64 + # macOS 3.8.10 and 3.9.1 introduced a second universal2 installer release. + # (3.9.0 did *not* have a universal2 installer) # universal2 installer for python 3.8 needs macos 11.0 to run on # and therefore x86_64 builds use the intel only installer. # Note that intel only installer can create universal2 wheels, but # creates intel only wheels by default. When PLAT=universal2 # we set the env variable _PYTHON_HOST_PLATFORM to change this # default. - if [ "$(uname -m)" == "arm64" ] && [ $(lex_ver $py_version) -ge $(lex_ver 3.9.0) ] \ - || [ $(lex_ver $py_version) -ge $(lex_ver 3.10.0) ]; then - if [ "$py_version" == "3.9.1" ]; then + if [ "$py_version" == "3.9.1" ]; then + # 3.9.1 used "macos11.0" rather than "macos11" in the installer name. echo "python-${py_version}-macos11.0.${inst_ext}" - else - echo "python-${py_version}-macos11.${inst_ext}" - fi else - local py_osx_ver=${2:-$(macpython_sdk_for_version $py_version)} - echo "python-${py_version}-macosx${py_osx_ver}.${inst_ext}" + local py_osx_ver=${2:-$(macpython_sdk_for_version $py_version)} + if [ "$py_osx_ver" == "11.0" ]; then + echo "python-${py_version}-macos11.${inst_ext}" + else + echo "python-${py_version}-macosx${py_osx_ver}.${inst_ext}" + fi fi } diff --git a/tests/test_osx_utils.sh b/tests/test_osx_utils.sh index 367a7d8e..2f7b9c99 100644 --- a/tests/test_osx_utils.sh +++ b/tests/test_osx_utils.sh @@ -14,8 +14,17 @@ [ "$(pyinst_fname_for_version 3.6.8)" == "python-3.6.8-macosx10.9.pkg" ] || ingest [ "$(pyinst_fname_for_version 3.7.1)" == "python-3.7.1-macosx10.9.pkg" ] || ingest [ "$(pyinst_fname_for_version 3.8.0)" == "python-3.8.0-macosx10.9.pkg" ] || ingest -[ "$(pyinst_fname_for_version 3.9.3)" == "python-3.9.3-macosx11.pkg" ] || ingest -[ "$(pyinst_fname_for_version 3.11.3)" == "python-3.11.3-macosx11.pkg" ] || ingest + +if [ "$(uname -m)" = "arm64" ]; then + [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macos11.pkg" ] || ingest + [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macos11.0.pkg" ] || ingest + [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macos11.pkg" ] || ingest +else + [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macosx10.9.pkg" ] || ingest + [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macosx10.9.pkg" ] || ingest + [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macosx10.9.pkg" ] || ingest +fi +[ "$(pyinst_fname_for_version 3.11.3)" == "python-3.11.3-macos11.pkg" ] || ingest [ "$(pyinst_fname_for_version 2.7.14 10.6)" == "python-2.7.14-macosx10.6.pkg" ] || ingest [ "$(pyinst_fname_for_version 2.7.15 10.6)" == "python-2.7.15-macosx10.6.pkg" ] || ingest @@ -48,36 +57,52 @@ [ "$(macpython_impl_for_version pypy-5.4)" == "pp" ] || ingest # Test lookup of available macOS SDK build targets from python version -if [ "$(uname -m)" != "arm64" ]; then - [ "$(macpython_sdk_list_for_version 3.11.3)" == "11.0" ] || ingest - [ "$(macpython_sdk_list_for_version 3.9.3)" == "10.9 11.0" ] || ingest +[ "$(macpython_sdk_list_for_version 3.11)" == "11.0" ] || ingest +[ "$(macpython_sdk_list_for_version 3.11.3)" == "11.0" ] || ingest +if [ "$(uname -m)" = "arm64" ]; then + [ "$(macpython_sdk_list_for_version 3.9)" == "10.9 11.0" ] || ingest + [ "$(macpython_sdk_list_for_version 3.9.3)" == "10.9 11.0" ] || ingest + [ "$(macpython_sdk_list_for_version 3.9.0)" == "10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 3.8)" == "10.9 11.0" ] || ingest + [ "$(macpython_sdk_list_for_version 3.8.10)" == "10.9 11.0" ] || ingest +else + [ "$(macpython_sdk_list_for_version 3.9)" == "10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 3.9.3)" == "10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 3.9.0)" == "10.9" ] || ingest [ "$(macpython_sdk_list_for_version 3.8)" == "10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.7.5)" == "10.6 10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.7)" == "10.6 10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.6.5)" == "10.6 10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.6)" == "10.6 10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.5)" == "10.6" ] || ingest - [ "$(macpython_sdk_list_for_version 2.7)" == "10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 2.7.14)" == "10.6" ] || ingest - [ "$(macpython_sdk_list_for_version 2.7.15)" == "10.6 10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 2.7.17)" == "10.6 10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 2.7.18)" == "10.9" ] || ingest + [ "$(macpython_sdk_list_for_version 3.8.10)" == "10.9" ] || ingest fi +[ "$(macpython_sdk_list_for_version 3.8.3)" == "10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 3.7.5)" == "10.6 10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 3.7)" == "10.6 10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 3.6.5)" == "10.6 10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 3.6)" == "10.6 10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 3.5)" == "10.6" ] || ingest +[ "$(macpython_sdk_list_for_version 2.7)" == "10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 2.7.14)" == "10.6" ] || ingest +[ "$(macpython_sdk_list_for_version 2.7.15)" == "10.6 10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 2.7.17)" == "10.6 10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 2.7.18)" == "10.9" ] || ingest -(PLAT="arm64"; [ "$(macpython_sdk_for_version 3.11)" == "11.0" ] || ingest) -(PLAT="universal2"; [ "$(macpython_sdk_for_version 3.11)" == "11.0" ] || ingest) -(PLAT="x86_64"; [ "$(macpython_sdk_for_version 3.11)" == "11.0" ] || ingest) - -(PLAT="arm64"; [ "$(macpython_sdk_for_version 3.9)" == "11.0" ] || ingest) -(PLAT="universal2"; [ "$(macpython_sdk_for_version 3.9)" == "11.0" ] || ingest) -(PLAT="x86_64"; [ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest) -if [ "$(uname -m)" != "arm64" ]; then +[ "$(macpython_sdk_for_version 3.11)" == "11.0" ] || ingest +[ "$(macpython_sdk_for_version 3.11.3)" == "11.0" ] || ingest +if [ "$(uname -m)" = "arm64" ]; then + [ "$(macpython_sdk_for_version 3.9)" == "11.0" ] || ingest + [ "$(macpython_sdk_for_version 3.9.3)" == "11.0" ] || ingest + [ "$(macpython_sdk_for_version 3.9.0)" == "10.9" ] || ingest + [ "$(macpython_sdk_for_version 3.8)" == "11.0" ] || ingest + [ "$(macpython_sdk_for_version 3.8.10)" == "11.0" ] || ingest +else [ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest + [ "$(macpython_sdk_for_version 3.9.3)" == "10.9" ] || ingest + [ "$(macpython_sdk_for_version 3.9.0)" == "10.9" ] || ingest [ "$(macpython_sdk_for_version 3.8)" == "10.9" ] || ingest - [ "$(macpython_sdk_for_version 3.5)" == "10.6" ] || ingest - [ "$(macpython_sdk_for_version 2.7)" == "10.9" ] || ingest - [ "$(macpython_sdk_for_version 2.7.14)" == "10.6" ] || ingest + [ "$(macpython_sdk_for_version 3.8.10)" == "10.9" ] || ingest fi +[ "$(macpython_sdk_for_version 3.8.3)" == "10.9" ] || ingest +[ "$(macpython_sdk_for_version 3.5)" == "10.6" ] || ingest +[ "$(macpython_sdk_for_version 2.7)" == "10.9" ] || ingest +[ "$(macpython_sdk_for_version 2.7.14)" == "10.6" ] || ingest # Test pkg-config install install_pkg_config From 83e29d8dd7fdec48073cb9ade15c6157f3ffc367 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 15:23:08 +0800 Subject: [PATCH 13/22] Another attempt at filename/arch handling. --- osx_utils.sh | 28 +++++++++------ tests/test_osx_utils.sh | 76 ++++++++++++++++------------------------- 2 files changed, 47 insertions(+), 57 deletions(-) diff --git a/osx_utils.sh b/osx_utils.sh index de8fae9e..97dab2f0 100644 --- a/osx_utils.sh +++ b/osx_utils.sh @@ -120,10 +120,8 @@ function macpython_sdk_list_for_version { elif [ "$_major" -eq "3" ]; then [ $(lex_ver $_ver) -lt $(lex_ver 3.8) ] && _return="10.6" [ $(lex_ver $_ver) -ge $(lex_ver 3.6.5) ] && _return="$_return 10.9" - if [ "$(uname -m)" == "arm64" ]; then - [ $(lex_ver $_ver) -ge $(lex_ver 3.8.10) ] && [ "$_ver" != "3.9.0" ] && _return="$_return 11.0" - fi - [ $(lex_ver $_ver) -ge $(lex_ver 3.10.0) ] && _return="11.0" + [ $(lex_ver $_ver) -ge $(lex_ver 3.8.10) ] && [ "$_ver" != "3.9.0" ] && _return="$_return 11.0" + [ $(lex_ver $_ver) -ge $(lex_ver 3.10) ] && _return="11.0" else echo "Error version=${_ver}, expecting 2.x or 3.x" 1>&2 exit 1 @@ -168,6 +166,7 @@ function pyinst_fname_for_version { # built for, eg: "10.6" or "10.9", if not defined, infers # this from $py_version using macpython_sdk_for_version local py_version=$1 + local py_osx_ver local inst_ext=$(pyinst_ext_for_version $py_version) # macOS 3.8.10 and 3.9.1 introduced a second universal2 installer release. # (3.9.0 did *not* have a universal2 installer) @@ -177,16 +176,23 @@ function pyinst_fname_for_version { # creates intel only wheels by default. When PLAT=universal2 # we set the env variable _PYTHON_HOST_PLATFORM to change this # default. - if [ "$py_version" == "3.9.1" ]; then - # 3.9.1 used "macos11.0" rather than "macos11" in the installer name. - echo "python-${py_version}-macos11.0.${inst_ext}" + if [ -z "$2" ] \ + && [ $(uname -m) == "arm64" ] \ + && [ $(lex_ver $_ver) -ge $(lex_ver 3.8.10) ] \ + && [ $(lex_ver $_ver) -lt $(lex_ver 3.10.0) ]; then + py_osx_ver="10.9" else - local py_osx_ver=${2:-$(macpython_sdk_for_version $py_version)} - if [ "$py_osx_ver" == "11.0" ]; then - echo "python-${py_version}-macos11.${inst_ext}" + py_osx_ver=$(macpython_sdk_for_version $py_version) + fi + + if [ "$py_osx_ver" == "11.0" ]; then + if [ "$py_version" == "3.9.1" ]; then + echo "python-${py_version}-macos11.0.${inst_ext}" else - echo "python-${py_version}-macosx${py_osx_ver}.${inst_ext}" + echo "python-${py_version}-macos11.${inst_ext}" fi + else + echo "python-${py_version}-macosx${py_osx_ver}.${inst_ext}" fi } diff --git a/tests/test_osx_utils.sh b/tests/test_osx_utils.sh index 2f7b9c99..3413c1af 100644 --- a/tests/test_osx_utils.sh +++ b/tests/test_osx_utils.sh @@ -10,29 +10,29 @@ [ "$(pyinst_ext_for_version 3)" == pkg ] || ingest [ "$(pyinst_fname_for_version 2.7.14)" == "python-2.7.14-macosx10.6.pkg" ] || ingest -[ "$(pyinst_fname_for_version 2.7.15)" == "python-2.7.15-macosx10.9.pkg" ] || ingest -[ "$(pyinst_fname_for_version 3.6.8)" == "python-3.6.8-macosx10.9.pkg" ] || ingest -[ "$(pyinst_fname_for_version 3.7.1)" == "python-3.7.1-macosx10.9.pkg" ] || ingest -[ "$(pyinst_fname_for_version 3.8.0)" == "python-3.8.0-macosx10.9.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 2.7.15)" == "python-2.7.15-macosx10.9.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.6.8)" == "python-3.6.8-macosx10.9.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.7.1)" == "python-3.7.1-macosx10.9.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.8.0)" == "python-3.8.0-macosx10.9.pkg" ] || ingest -if [ "$(uname -m)" = "arm64" ]; then - [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macos11.pkg" ] || ingest - [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macos11.0.pkg" ] || ingest - [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macos11.pkg" ] || ingest -else - [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macosx10.9.pkg" ] || ingest - [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macosx10.9.pkg" ] || ingest - [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macosx10.9.pkg" ] || ingest -fi -[ "$(pyinst_fname_for_version 3.11.3)" == "python-3.11.3-macos11.pkg" ] || ingest +# if [ "$(uname -m)" = "arm64" ]; then +# [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macos11.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macos11.0.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macos11.pkg" ] || ingest +# else +# [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macosx10.9.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macosx10.9.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macosx10.9.pkg" ] || ingest +# fi +# [ "$(pyinst_fname_for_version 3.11.3)" == "python-3.11.3-macos11.pkg" ] || ingest -[ "$(pyinst_fname_for_version 2.7.14 10.6)" == "python-2.7.14-macosx10.6.pkg" ] || ingest -[ "$(pyinst_fname_for_version 2.7.15 10.6)" == "python-2.7.15-macosx10.6.pkg" ] || ingest -[ "$(pyinst_fname_for_version 3.6.8 10.6)" == "python-3.6.8-macosx10.6.pkg" ] || ingest -[ "$(pyinst_fname_for_version 3.7.1 10.6)" == "python-3.7.1-macosx10.6.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 2.7.14 10.6)" == "python-2.7.14-macosx10.6.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 2.7.15 10.6)" == "python-2.7.15-macosx10.6.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.6.8 10.6)" == "python-3.6.8-macosx10.6.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.7.1 10.6)" == "python-3.7.1-macosx10.6.pkg" ] || ingest -[ "$(pyinst_fname_for_version 2.7.15 10.11)" == "python-2.7.15-macosx10.11.pkg" ] || ingest -[ "$(pyinst_fname_for_version 3.7.1 10.12)" == "python-3.7.1-macosx10.12.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 2.7.15 10.11)" == "python-2.7.15-macosx10.11.pkg" ] || ingest +# [ "$(pyinst_fname_for_version 3.7.1 10.12)" == "python-3.7.1-macosx10.12.pkg" ] || ingest # Test utilities for getting Python version versions [ "$(get_py_digit)" == "${cpython_version:0:1}" ] || ingest @@ -59,19 +59,11 @@ fi # Test lookup of available macOS SDK build targets from python version [ "$(macpython_sdk_list_for_version 3.11)" == "11.0" ] || ingest [ "$(macpython_sdk_list_for_version 3.11.3)" == "11.0" ] || ingest -if [ "$(uname -m)" = "arm64" ]; then - [ "$(macpython_sdk_list_for_version 3.9)" == "10.9 11.0" ] || ingest - [ "$(macpython_sdk_list_for_version 3.9.3)" == "10.9 11.0" ] || ingest - [ "$(macpython_sdk_list_for_version 3.9.0)" == "10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.8)" == "10.9 11.0" ] || ingest - [ "$(macpython_sdk_list_for_version 3.8.10)" == "10.9 11.0" ] || ingest -else - [ "$(macpython_sdk_list_for_version 3.9)" == "10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.9.3)" == "10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.9.0)" == "10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.8)" == "10.9" ] || ingest - [ "$(macpython_sdk_list_for_version 3.8.10)" == "10.9" ] || ingest -fi +[ "$(macpython_sdk_list_for_version 3.9)" == "10.9 11.0" ] || ingest +[ "$(macpython_sdk_list_for_version 3.9.3)" == "10.9 11.0" ] || ingest +[ "$(macpython_sdk_list_for_version 3.9.0)" == "10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 3.8)" == "10.9 11.0" ] || ingest +[ "$(macpython_sdk_list_for_version 3.8.10)" == "10.9 11.0" ] || ingest [ "$(macpython_sdk_list_for_version 3.8.3)" == "10.9" ] || ingest [ "$(macpython_sdk_list_for_version 3.7.5)" == "10.6 10.9" ] || ingest [ "$(macpython_sdk_list_for_version 3.7)" == "10.6 10.9" ] || ingest @@ -86,19 +78,11 @@ fi [ "$(macpython_sdk_for_version 3.11)" == "11.0" ] || ingest [ "$(macpython_sdk_for_version 3.11.3)" == "11.0" ] || ingest -if [ "$(uname -m)" = "arm64" ]; then - [ "$(macpython_sdk_for_version 3.9)" == "11.0" ] || ingest - [ "$(macpython_sdk_for_version 3.9.3)" == "11.0" ] || ingest - [ "$(macpython_sdk_for_version 3.9.0)" == "10.9" ] || ingest - [ "$(macpython_sdk_for_version 3.8)" == "11.0" ] || ingest - [ "$(macpython_sdk_for_version 3.8.10)" == "11.0" ] || ingest -else - [ "$(macpython_sdk_for_version 3.9)" == "10.9" ] || ingest - [ "$(macpython_sdk_for_version 3.9.3)" == "10.9" ] || ingest - [ "$(macpython_sdk_for_version 3.9.0)" == "10.9" ] || ingest - [ "$(macpython_sdk_for_version 3.8)" == "10.9" ] || ingest - [ "$(macpython_sdk_for_version 3.8.10)" == "10.9" ] || ingest -fi +[ "$(macpython_sdk_for_version 3.9)" == "11.0" ] || ingest +[ "$(macpython_sdk_for_version 3.9.3)" == "11.0" ] || ingest +[ "$(macpython_sdk_for_version 3.9.0)" == "10.9" ] || ingest +[ "$(macpython_sdk_for_version 3.8)" == "11.0" ] || ingest +[ "$(macpython_sdk_for_version 3.8.10)" == "11.0" ] || ingest [ "$(macpython_sdk_for_version 3.8.3)" == "10.9" ] || ingest [ "$(macpython_sdk_for_version 3.5)" == "10.6" ] || ingest [ "$(macpython_sdk_for_version 2.7)" == "10.9" ] || ingest From 7e7edc8773ff681867f124ff6c53e27569e004f7 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 15:24:24 +0800 Subject: [PATCH 14/22] Genericize use of git. --- common_utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common_utils.sh b/common_utils.sh index 50049110..6860a2ac 100755 --- a/common_utils.sh +++ b/common_utils.sh @@ -399,9 +399,9 @@ function build_index_wheel_cmd { if [ -n "$(is_function "pre_build")" ]; then pre_build; fi stop_spinner if [ -n "$BUILD_DEPENDS" ]; then - pip install $(pip_opts) $@ $BUILD_DEPENDS + $PIP_CMD install $(pip_opts) $@ $BUILD_DEPENDS fi - pip wheel $(pip_opts) $@ -w $wheelhouse --no-deps $project_spec + $PIP_CMD wheel $(pip_opts) $@ -w $wheelhouse --no-deps $project_spec repair_wheelhouse $wheelhouse } From 65de03743de9b808a1aa9cce505abe5991d26684 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 15:46:41 +0800 Subject: [PATCH 15/22] Fix the supported wheel test. --- tests/test_supported_wheels.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_supported_wheels.sh b/tests/test_supported_wheels.sh index 6b59a7a7..f114cfde 100644 --- a/tests/test_supported_wheels.sh +++ b/tests/test_supported_wheels.sh @@ -30,16 +30,23 @@ fi py_impl=$($PYTHON_EXE -c 'import platform; print(platform.python_implementation())') if [ "$py_impl" == 'CPython' ] && [ $(uname) == 'Darwin' ]; then our_ver=$($PYTHON_EXE -c 'import sys; print("{}{}".format(*sys.version_info[:2]))') + our_arch=$($PYTHON_EXE -c 'import os; print(os.uname().machine())') + other_arch=$($PYTHON_EXE -c 'import os; print("x86_64" if os.uname().machine() == "arm64" else "x86_64")') other_ver=$([ "$our_ver" == "37" ] && echo "36" || echo "37") # Python <= 3.7 needs m for API tag. api_m=$([ $our_ver -le 37 ] && echo "m") || : - whl_suff="cp${our_ver}-cp${our_ver}${api_m}-macosx_10_9_x86_64.whl" + whl_suff="cp${our_ver}-cp${our_ver}${api_m}-macosx_10_9_${our_arch}.whl" good_whl="tornado-5.1-${whl_suff}" - bad_whl="tornado-5.1-cp${other_ver}-cp${other_ver}m-macosx_10_9_x86_64.whl" + bad_whl="tornado-5.1-cp${other_ver}-cp${other_ver}m-macosx_10_9_${our_arch}.whl" + bad_arch_whl="tornado-5.1-cp${our_ver}-cp${our_ver}${api_m}-macosx_10_9_${other_arch}.whl" if [ "$($PYTHON_EXE supported_wheels.py $bad_whl)" != "" ]; then echo "$bad_whl not supported, but supported wheels says it is." RET=1 fi + if [ "$($PYTHON_EXE supported_wheels.py $bad_arch_whl)" != "" ]; then + echo "$bad_arch_whl not supported, but supported wheels says it is." + RET=1 + fi if [ "$($PYTHON_EXE supported_wheels.py $good_whl)" != "$good_whl" ]; then echo "$good_whl supported, but supported wheels says it is not." RET=1 @@ -56,4 +63,3 @@ $good_whl2" RET=1 fi fi - From 5ef2c7522eae5efd46e2ed51ce9e1cd61bd39df1 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 15:59:09 +0800 Subject: [PATCH 16/22] One more pass at python version fixes. --- osx_utils.sh | 15 ++++++++----- tests/test_osx_utils.sh | 40 +++++++++++++++++----------------- tests/test_supported_wheels.sh | 4 ++-- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/osx_utils.sh b/osx_utils.sh index 97dab2f0..60610f45 100644 --- a/osx_utils.sh +++ b/osx_utils.sh @@ -176,13 +176,16 @@ function pyinst_fname_for_version { # creates intel only wheels by default. When PLAT=universal2 # we set the env variable _PYTHON_HOST_PLATFORM to change this # default. - if [ -z "$2" ] \ - && [ $(uname -m) == "arm64" ] \ - && [ $(lex_ver $_ver) -ge $(lex_ver 3.8.10) ] \ - && [ $(lex_ver $_ver) -lt $(lex_ver 3.10.0) ]; then - py_osx_ver="10.9" + if [ -z "$2" ]; then + if [ $(uname -m) == "arm64" ] \ + && [ $(lex_ver $_ver) -ge $(lex_ver 3.8.10) ] \ + && [ $(lex_ver $_ver) -lt $(lex_ver 3.10.0) ]; then + py_osx_ver="10.9" + else + py_osx_ver=$(macpython_sdk_for_version $py_version) + fi else - py_osx_ver=$(macpython_sdk_for_version $py_version) + py_osx_ver=$2 fi if [ "$py_osx_ver" == "11.0" ]; then diff --git a/tests/test_osx_utils.sh b/tests/test_osx_utils.sh index 3413c1af..28fd5865 100644 --- a/tests/test_osx_utils.sh +++ b/tests/test_osx_utils.sh @@ -10,29 +10,29 @@ [ "$(pyinst_ext_for_version 3)" == pkg ] || ingest [ "$(pyinst_fname_for_version 2.7.14)" == "python-2.7.14-macosx10.6.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 2.7.15)" == "python-2.7.15-macosx10.9.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.6.8)" == "python-3.6.8-macosx10.9.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.7.1)" == "python-3.7.1-macosx10.9.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.8.0)" == "python-3.8.0-macosx10.9.pkg" ] || ingest +[ "$(pyinst_fname_for_version 2.7.15)" == "python-2.7.15-macosx10.9.pkg" ] || ingest +[ "$(pyinst_fname_for_version 3.6.8)" == "python-3.6.8-macosx10.9.pkg" ] || ingest +[ "$(pyinst_fname_for_version 3.7.1)" == "python-3.7.1-macosx10.9.pkg" ] || ingest +[ "$(pyinst_fname_for_version 3.8.0)" == "python-3.8.0-macosx10.9.pkg" ] || ingest -# if [ "$(uname -m)" = "arm64" ]; then -# [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macos11.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macos11.0.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macos11.pkg" ] || ingest -# else -# [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macosx10.9.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macosx10.9.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macosx10.9.pkg" ] || ingest -# fi -# [ "$(pyinst_fname_for_version 3.11.3)" == "python-3.11.3-macos11.pkg" ] || ingest +if [ "$(uname -m)" = "arm64" ]; then + [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macos11.pkg" ] || ingest + [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macos11.0.pkg" ] || ingest + [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macos11.pkg" ] || ingest +else + [ "$(pyinst_fname_for_version 3.8.10)" == "python-3.8.10-macosx10.9.pkg" ] || ingest + [ "$(pyinst_fname_for_version 3.9.1)" == "python-3.9.1-macosx10.9.pkg" ] || ingest + [ "$(pyinst_fname_for_version 3.9.2)" == "python-3.9.2-macosx10.9.pkg" ] || ingest +fi +[ "$(pyinst_fname_for_version 3.11.3)" == "python-3.11.3-macos11.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 2.7.14 10.6)" == "python-2.7.14-macosx10.6.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 2.7.15 10.6)" == "python-2.7.15-macosx10.6.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.6.8 10.6)" == "python-3.6.8-macosx10.6.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.7.1 10.6)" == "python-3.7.1-macosx10.6.pkg" ] || ingest +[ "$(pyinst_fname_for_version 2.7.14 10.6)" == "python-2.7.14-macosx10.6.pkg" ] || ingest +[ "$(pyinst_fname_for_version 2.7.15 10.6)" == "python-2.7.15-macosx10.6.pkg" ] || ingest +[ "$(pyinst_fname_for_version 3.6.8 10.6)" == "python-3.6.8-macosx10.6.pkg" ] || ingest +[ "$(pyinst_fname_for_version 3.7.1 10.6)" == "python-3.7.1-macosx10.6.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 2.7.15 10.11)" == "python-2.7.15-macosx10.11.pkg" ] || ingest -# [ "$(pyinst_fname_for_version 3.7.1 10.12)" == "python-3.7.1-macosx10.12.pkg" ] || ingest +[ "$(pyinst_fname_for_version 2.7.15 10.11)" == "python-2.7.15-macosx10.11.pkg" ] || ingest +[ "$(pyinst_fname_for_version 3.7.1 10.12)" == "python-3.7.1-macosx10.12.pkg" ] || ingest # Test utilities for getting Python version versions [ "$(get_py_digit)" == "${cpython_version:0:1}" ] || ingest diff --git a/tests/test_supported_wheels.sh b/tests/test_supported_wheels.sh index f114cfde..82467413 100644 --- a/tests/test_supported_wheels.sh +++ b/tests/test_supported_wheels.sh @@ -30,8 +30,8 @@ fi py_impl=$($PYTHON_EXE -c 'import platform; print(platform.python_implementation())') if [ "$py_impl" == 'CPython' ] && [ $(uname) == 'Darwin' ]; then our_ver=$($PYTHON_EXE -c 'import sys; print("{}{}".format(*sys.version_info[:2]))') - our_arch=$($PYTHON_EXE -c 'import os; print(os.uname().machine())') - other_arch=$($PYTHON_EXE -c 'import os; print("x86_64" if os.uname().machine() == "arm64" else "x86_64")') + our_arch=$($PYTHON_EXE -c 'import os; print(os.uname().machine)') + other_arch=$($PYTHON_EXE -c 'import os; print("x86_64" if os.uname().machine == "arm64" else "x86_64")') other_ver=$([ "$our_ver" == "37" ] && echo "36" || echo "37") # Python <= 3.7 needs m for API tag. api_m=$([ $our_ver -le 37 ] && echo "m") || : From 9b48e07005c2436941ba78cea0e547dc17da5ad4 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 16:08:53 +0800 Subject: [PATCH 17/22] Fix the macOS installer naming for x86_64 --- osx_utils.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osx_utils.sh b/osx_utils.sh index 60610f45..db630354 100644 --- a/osx_utils.sh +++ b/osx_utils.sh @@ -409,9 +409,6 @@ function get_macpython_environment { # $venv_dir : {directory_name|not defined} # If defined - make virtualenv in this directory, set python / pip # commands accordingly - # $py_osx_ver: {major.minor | not defined} - # if defined, the macOS version that Python is built for, e.g. - # "10.6" or "10.9", if not defined, use the version from MB_PYTHON_OSX_VER # # Installs Python # Sets $PYTHON_EXE to path to Python executable @@ -420,14 +417,13 @@ function get_macpython_environment { # Puts directory of $PYTHON_EXE on $PATH local version=$1 local venv_dir=$2 - local py_osx_ver=${3:-$MB_PYTHON_OSX_VER} if [ "$USE_CCACHE" == "1" ]; then activate_ccache fi remove_travis_ve_pip - install_macpython $version $py_osx_ver + install_macpython $version PIP_CMD="$PYTHON_EXE -m pip" # Python 3.5 no longer compatible with latest pip if [ "$(get_py_mm)" == "3.5" ]; then From 80da58231265578d177b115e6810ae1f34aedad2 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 16:23:35 +0800 Subject: [PATCH 18/22] Use the actual platform's tag for supported wheel tests. --- tests/test_supported_wheels.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_supported_wheels.sh b/tests/test_supported_wheels.sh index 82467413..001b6cf4 100644 --- a/tests/test_supported_wheels.sh +++ b/tests/test_supported_wheels.sh @@ -30,7 +30,7 @@ fi py_impl=$($PYTHON_EXE -c 'import platform; print(platform.python_implementation())') if [ "$py_impl" == 'CPython' ] && [ $(uname) == 'Darwin' ]; then our_ver=$($PYTHON_EXE -c 'import sys; print("{}{}".format(*sys.version_info[:2]))') - our_arch=$($PYTHON_EXE -c 'import os; print(os.uname().machine)') + our_tag=$($PYTHON_EXE -c 'import sysconfig; print(sysconfig.get_platform().replace("-","_").replace(".","_"))') other_arch=$($PYTHON_EXE -c 'import os; print("x86_64" if os.uname().machine == "arm64" else "x86_64")') other_ver=$([ "$our_ver" == "37" ] && echo "36" || echo "37") # Python <= 3.7 needs m for API tag. From ba29a96e64e7fd5da8654e73d7b46d94605b1326 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 17:12:23 +0800 Subject: [PATCH 19/22] One more try at supported wheel testing. --- tests/test_supported_wheels.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/test_supported_wheels.sh b/tests/test_supported_wheels.sh index 001b6cf4..d79e680e 100644 --- a/tests/test_supported_wheels.sh +++ b/tests/test_supported_wheels.sh @@ -31,22 +31,16 @@ py_impl=$($PYTHON_EXE -c 'import platform; print(platform.python_implementation( if [ "$py_impl" == 'CPython' ] && [ $(uname) == 'Darwin' ]; then our_ver=$($PYTHON_EXE -c 'import sys; print("{}{}".format(*sys.version_info[:2]))') our_tag=$($PYTHON_EXE -c 'import sysconfig; print(sysconfig.get_platform().replace("-","_").replace(".","_"))') - other_arch=$($PYTHON_EXE -c 'import os; print("x86_64" if os.uname().machine == "arm64" else "x86_64")') other_ver=$([ "$our_ver" == "37" ] && echo "36" || echo "37") # Python <= 3.7 needs m for API tag. api_m=$([ $our_ver -le 37 ] && echo "m") || : - whl_suff="cp${our_ver}-cp${our_ver}${api_m}-macosx_10_9_${our_arch}.whl" + whl_suff="cp${our_ver}-cp${our_ver}${api_m}-${our_tag}.whl" good_whl="tornado-5.1-${whl_suff}" - bad_whl="tornado-5.1-cp${other_ver}-cp${other_ver}m-macosx_10_9_${our_arch}.whl" - bad_arch_whl="tornado-5.1-cp${our_ver}-cp${our_ver}${api_m}-macosx_10_9_${other_arch}.whl" + bad_whl="tornado-5.1-cp${other_ver}-cp${other_ver}m-${our_tag}.whl" if [ "$($PYTHON_EXE supported_wheels.py $bad_whl)" != "" ]; then echo "$bad_whl not supported, but supported wheels says it is." RET=1 fi - if [ "$($PYTHON_EXE supported_wheels.py $bad_arch_whl)" != "" ]; then - echo "$bad_arch_whl not supported, but supported wheels says it is." - RET=1 - fi if [ "$($PYTHON_EXE supported_wheels.py $good_whl)" != "$good_whl" ]; then echo "$good_whl supported, but supported wheels says it is not." RET=1 From 3c43a835a728828bd138adddc354e7842ba84265 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 17:38:17 +0800 Subject: [PATCH 20/22] one of these times... --- osx_utils.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osx_utils.sh b/osx_utils.sh index db630354..689a9ac8 100644 --- a/osx_utils.sh +++ b/osx_utils.sh @@ -177,10 +177,13 @@ function pyinst_fname_for_version { # we set the env variable _PYTHON_HOST_PLATFORM to change this # default. if [ -z "$2" ]; then - if [ $(uname -m) == "arm64" ] \ - && [ $(lex_ver $_ver) -ge $(lex_ver 3.8.10) ] \ + if [ $(lex_ver $_ver) -ge $(lex_ver 3.8.10) ] \ && [ $(lex_ver $_ver) -lt $(lex_ver 3.10.0) ]; then - py_osx_ver="10.9" + if [ $(uname -m) == "x86_64" ]; then + py_osx_ver="10.9" + else + py_osx_ver="11.0" + fi else py_osx_ver=$(macpython_sdk_for_version $py_version) fi From e85e5727c1c4d1d30eb5dda7b678655b8de94c2b Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Oct 2024 18:01:46 +0800 Subject: [PATCH 21/22] Please let this be the one... --- osx_utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osx_utils.sh b/osx_utils.sh index 689a9ac8..e43319e9 100644 --- a/osx_utils.sh +++ b/osx_utils.sh @@ -177,8 +177,8 @@ function pyinst_fname_for_version { # we set the env variable _PYTHON_HOST_PLATFORM to change this # default. if [ -z "$2" ]; then - if [ $(lex_ver $_ver) -ge $(lex_ver 3.8.10) ] \ - && [ $(lex_ver $_ver) -lt $(lex_ver 3.10.0) ]; then + if [ $(lex_ver $py_version) -ge $(lex_ver 3.8.10) ] \ + && [ $(lex_ver $py_version) -lt $(lex_ver 3.10.0) ]; then if [ $(uname -m) == "x86_64" ]; then py_osx_ver="10.9" else From c493b651211ca83eef38108b80f9965b82f21e45 Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Tue, 22 Oct 2024 13:58:52 +0300 Subject: [PATCH 22/22] Update tests/test_osx_utils.sh Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com> --- tests/test_osx_utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_osx_utils.sh b/tests/test_osx_utils.sh index 28fd5865..6ea44b88 100644 --- a/tests/test_osx_utils.sh +++ b/tests/test_osx_utils.sh @@ -63,8 +63,8 @@ fi [ "$(macpython_sdk_list_for_version 3.9.3)" == "10.9 11.0" ] || ingest [ "$(macpython_sdk_list_for_version 3.9.0)" == "10.9" ] || ingest [ "$(macpython_sdk_list_for_version 3.8)" == "10.9 11.0" ] || ingest -[ "$(macpython_sdk_list_for_version 3.8.10)" == "10.9 11.0" ] || ingest -[ "$(macpython_sdk_list_for_version 3.8.3)" == "10.9" ] || ingest +[ "$(macpython_sdk_list_for_version 3.8.10)" == "10.9 11.0" ] || ingest +[ "$(macpython_sdk_list_for_version 3.8.3)" == "10.9" ] || ingest [ "$(macpython_sdk_list_for_version 3.7.5)" == "10.6 10.9" ] || ingest [ "$(macpython_sdk_list_for_version 3.7)" == "10.6 10.9" ] || ingest [ "$(macpython_sdk_list_for_version 3.6.5)" == "10.6 10.9" ] || ingest