Skip to content

Commit 6549a90

Browse files
authored
Merge pull request #1217 from mayeut/no-universal2
fix: don't build `universal2` as a default on macOS arm64 runners
2 parents 024ac0f + ac42f66 commit 6549a90

6 files changed

Lines changed: 16 additions & 20 deletions

File tree

cibuildwheel/architecture.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ def auto_archs(platform: PlatformName) -> set[Architecture]:
6666
if platform == "windows" and native_architecture == Architecture.AMD64:
6767
result.add(Architecture.x86)
6868

69-
if platform == "macos" and native_architecture == Architecture.arm64:
70-
# arm64 can build and test both archs of a universal2 wheel.
71-
result.add(Architecture.universal2)
72-
7369
return result
7470

7571
@staticmethod

docs/faq.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ to load on Apple Silicon.
5353
available.
5454

5555
Generally speaking, because Pip 20.3 is required for the `universal2` wheel,
56-
most packages should provide both `x86_64` and `universal2` wheels for now.
57-
Once Pip 20.3+ is common on macOS, then it should be possible to ship only the
58-
`universal2` wheel.
56+
most packages should provide both `x86_64` and one of `universal2`/`arm64`
57+
wheels for now. When Pip 20.3+ is common on macOS, then it might be possible
58+
to ship only the `universal2` wheel.
5959

60-
**Apple Silicon wheels are not built by default**, but can be enabled by adding extra archs to the [`CIBW_ARCHS_MACOS` option](options.md#archs) - e.g. `x86_64 arm64 universal2`. Cross-compilation is provided by the Xcode toolchain.
60+
**Apple Silicon wheels are not built by default on Intel runners**, but can be enabled by adding extra archs to the [`CIBW_ARCHS_MACOS` option](options.md#archs) - e.g. `x86_64 arm64`. Cross-compilation is provided by the Xcode toolchain.
6161

6262
!!! important
6363
When cross-compiling on Intel, it is not possible to test `arm64` and the `arm64` part of a `universal2` wheel.
@@ -66,8 +66,7 @@ Once Pip 20.3+ is common on macOS, then it should be possible to ship only the
6666

6767
Hopefully, cross-compilation is a temporary situation. Once we have widely
6868
available Apple Silicon CI runners, we can build and test `arm64` and
69-
`universal2` wheels natively. That's why `universal2` wheels are not yet built
70-
by default, and require opt-in by setting `CIBW_ARCHS_MACOS`.
69+
`universal2` wheels natively. That's why `universal2`/`arm64` wheels require opt-in by setting `CIBW_ARCHS_MACOS`.
7170

7271
!!! note
7372
Your runner needs Xcode Command Line Tools 12.2 or later to build `universal2` or `arm64`.

docs/options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Default: `auto`
351351
| Linux / Intel | `x86_64` | `x86_64` `i686` | `x86_64` | `i686` |
352352
| Windows / Intel | `AMD64` | `AMD64` `x86` | `AMD64` | `x86` |
353353
| macOS / Intel | `x86_64` | `x86_64` | `x86_64` | |
354-
| macOS / Apple Silicon | `arm64` | `arm64` `universal2` | `arm64` `universal2`| |
354+
| macOS / Apple Silicon | `arm64` | `arm64` | `arm64` | |
355355

356356
If not listed above, `auto` is the same as `native`.
357357

examples/github-apple-silicon.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Build wheels
1313
uses: pypa/[email protected]
1414
env:
15-
CIBW_ARCHS_MACOS: x86_64 universal2
15+
CIBW_ARCHS_MACOS: x86_64 arm64
1616

1717
- uses: actions/upload-artifact@v3
1818
with:

test/test_macos_archs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
ALL_MACOS_WHEELS = {
1313
*utils.expected_wheels("spam", "0.1.0", machine_arch="x86_64"),
14-
*utils.expected_wheels("spam", "0.1.0", machine_arch="arm64"),
14+
*utils.expected_wheels("spam", "0.1.0", machine_arch="arm64", include_universal2=True),
1515
}
1616

1717

test/utils.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def expected_wheels(
116116
macosx_deployment_target="10.9",
117117
machine_arch=None,
118118
python_abi_tags=None,
119+
include_universal2=False,
119120
):
120121
"""
121122
Returns a list of expected wheels from a run of cibuildwheel.
@@ -199,14 +200,14 @@ def expected_wheels(
199200
arm64_macosx_deployment_target = _get_arm64_macosx_deployment_target(
200201
macosx_deployment_target
201202
)
202-
platform_tags = [
203-
f'macosx_{macosx_deployment_target.replace(".", "_")}_universal2',
204-
f'macosx_{arm64_macosx_deployment_target.replace(".", "_")}_arm64',
205-
]
203+
platform_tags = [f'macosx_{arm64_macosx_deployment_target.replace(".", "_")}_arm64']
206204
else:
207-
platform_tags = [
208-
f'macosx_{macosx_deployment_target.replace(".", "_")}_x86_64',
209-
]
205+
platform_tags = [f'macosx_{macosx_deployment_target.replace(".", "_")}_x86_64']
206+
207+
if include_universal2:
208+
platform_tags.append(
209+
f'macosx_{macosx_deployment_target.replace(".", "_")}_universal2',
210+
)
210211

211212
else:
212213
raise Exception("unsupported platform")

0 commit comments

Comments
 (0)