From 0a21bdbc4890baf34373ebcf535d8228d78bbfe8 Mon Sep 17 00:00:00 2001 From: Marcelo Duarte Date: Mon, 30 Dec 2024 19:27:42 -0300 Subject: [PATCH] build-wheel: build only universal2 wheels on macOS --- .github/workflows/build-wheel.yml | 5 ++--- ci/build-wheel.sh | 12 ++++++------ pyproject.toml | 4 +--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml index cdd666c23..692353cf8 100644 --- a/.github/workflows/build-wheel.yml +++ b/.github/workflows/build-wheel.yml @@ -25,8 +25,8 @@ jobs: include = [ {"os": "ubuntu-latest", "arch": "x86_64", "tag": "cp3*-manylinux_x86_64"}, {"os": "windows-latest", "arch": "x86_64", "tag": "cp3*-win_amd64"}, - {"os": "macos-13", "arch": "x86_64", "tag": "cp3{9,10}-macosx_x86_64"}, - {"os": "macos-14", "arch": "arm64", "tag": "cp3{11,12,13}-macosx_arm64"}, + {"os": "macos-13", "arch": "universal2", "tag": "cp3{9,10,11}-macosx_universal2"}, + {"os": "macos-14", "arch": "universal2", "tag": "cp3{12,13}*-macosx_universal2"}, ] if "${{ github.event_name }}" != "pull_request": include += [ @@ -34,7 +34,6 @@ jobs: {"os": "ubuntu-latest", "arch": "arm64", "tag": "cp3*-manylinux_aarch64"}, {"os": "ubuntu-latest", "arch": "arm64", "tag": "cp3*-musllinux_aarch64"}, {"os": "ubuntu-latest", "arch": "ppc64le", "tag": "cp3*-manylinux_ppc64le"}, - {"os": "macos-14", "arch": "universal2", "tag": "cp3{11,12,13}-macosx_universal2"}, ] with open(os.environ["GITHUB_OUTPUT"], "a+") as f: print("data="+json.dumps({"include": include}), file=f) diff --git a/ci/build-wheel.sh b/ci/build-wheel.sh index fbc57b47a..0443871e9 100755 --- a/ci/build-wheel.sh +++ b/ci/build-wheel.sh @@ -10,13 +10,13 @@ PY_VERSION_NODOT=$($PYTHON -c "import sysconfig; print(sysconfig.get_config_var( PYTHON_TAG=cp$PY_VERSION_NODOT if [[ $PY_PLATFORM == linux* ]]; then PLATFORM_TAG=many$(echo $PY_PLATFORM | sed 's/\-/_/') - PLATFORM_TAG_MASK=$(echo $PLATFORM_TAG | sed 's/_/*_/') + PLATFORM_TAG_MASK="$(echo $PLATFORM_TAG | sed 's/_/*_/')" if ! [ "$CI" == "true" ] && which podman >/dev/null; then export CIBW_CONTAINER_ENGINE=podman fi else PLATFORM_TAG=$(echo $PY_PLATFORM | sed 's/\-/_/') - PLATFORM_TAG_MASK=$(echo $PLATFORM_TAG | sed 's/_/*/') + PLATFORM_TAG_MASK="$(echo $PLATFORM_TAG | sed 's/_/*/')" fi # Usage @@ -42,7 +42,7 @@ while ! [ -z "$1" ]; do BUILD_TAG="" fi else - BUILD_TAG=$1 + BUILD_TAG="$1" fi shift done @@ -91,13 +91,13 @@ fi echo "::group::Build wheel(s)" if [ "$BUILD_TAG" == "--only" ]; then DIRTY=$(_bump_my_version show scm_info.dirty) - FILEMASK=cx_Freeze-$VERSION_OK-$PYTHON_TAG-$PYTHON_TAG-$PLATFORM_TAG_MASK - FILEEXISTS=$(ls wheelhouse/$FILEMASK.whl 2>/dev/null || echo '') + FILEMASK="cx_Freeze-$VERSION_OK-$PYTHON_TAG-$PYTHON_TAG-$PLATFORM_TAG_MASK" + FILEEXISTS=$(ls "wheelhouse/$FILEMASK.whl" 2>/dev/null || echo '') if [ "$DIRTY" != "False" ] || [ -z "$FILEEXISTS" ]; then if [[ $PY_PLATFORM == win* ]]; then uv build --no-build-isolation --wheel -o wheelhouse else - _cibuildwheel --only $PYTHON_TAG-$PLATFORM_TAG + _cibuildwheel --only "$PYTHON_TAG-$PLATFORM_TAG" fi fi elif ! [ -z "$BUILD_TAG" ]; then diff --git a/pyproject.toml b/pyproject.toml index e32659e57..08315b507 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -162,13 +162,11 @@ optional_value = "final" [tool.cibuildwheel] before-build = "uv pip install -r requirements.txt" -build = "cp3*" build-frontend = "build[uv]" build-verbosity = 1 skip = [ "cp3{9,10,13}-musllinux_*", "cp3{9,10,13}-manylinux_ppc64le", - "cp3{9,10}-macosx_{universal2,arm64}", ] [tool.cibuildwheel.linux] @@ -179,7 +177,7 @@ cd /opt/_internal && tar -xvf static-libs-for-embedding-only.tar.xz repair-wheel-command = "auditwheel repair -L /bases/lib -w {dest_dir} {wheel}" [tool.cibuildwheel.macos] -archs = "x86_64 universal2 arm64" +archs = "universal2" repair-wheel-command = """ delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -L bases/lib -w {dest_dir} {wheel}