Skip to content

Commit 9e3daa1

Browse files
authored
Fix arm wheels on macOS (#4017)
1 parent 4483246 commit 9e3daa1

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.github/workflows/pypi_upload.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ jobs:
6868
- name: generate matrix (PR)
6969
if: github.event_name == 'pull_request'
7070
run: |
71-
cibuildwheel --print-build-identifiers --platform linux \
72-
| pyp 'json.dumps({"only": x, "os": "ubuntu-latest"})' \
73-
| pyp 'json.dumps(list(map(json.loads, lines)))' > /tmp/matrix
71+
{
72+
cibuildwheel --print-build-identifiers --platform linux \
73+
| pyp 'json.dumps({"only": x, "os": "ubuntu-latest"})'
74+
} | pyp 'json.dumps(list(map(json.loads, lines)))' > /tmp/matrix
7475
env:
7576
CIBW_BUILD: "cp38-* cp311-*"
7677
CIBW_ARCHS_LINUX: x86_64

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
<!-- Changes that improve Black's performance. -->
4040

41+
- Fix mypyc builds on arm64 on macOS (#4017)
42+
4143
### Output
4244

4345
<!-- Changes to Black's terminal output and error messages -->

pyproject.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ exclude = ["/profiling"]
113113
[tool.hatch.build.targets.wheel]
114114
only-include = ["src"]
115115
sources = ["src"]
116+
# Note that we change the behaviour of this flag below
117+
macos-max-compat = true
116118

117119
[tool.hatch.build.targets.wheel.hooks.mypyc]
118120
enable-by-default = false
@@ -175,9 +177,18 @@ before-build = [
175177
HATCH_BUILD_HOOKS_ENABLE = "1"
176178
MYPYC_OPT_LEVEL = "3"
177179
MYPYC_DEBUG_LEVEL = "0"
180+
AIOHTTP_NO_EXTENSIONS = "1"
181+
178182
# Black needs Clang to compile successfully on Linux.
179183
CC = "clang"
180-
AIOHTTP_NO_EXTENSIONS = "1"
184+
185+
[tool.cibuildwheel.macos]
186+
build-frontend = { name = "build", args = ["--no-isolation"] }
187+
# Unfortunately, hatch doesn't respect MACOSX_DEPLOYMENT_TARGET
188+
before-build = [
189+
"python -m pip install 'hatchling==1.18.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.5.1' 'click==8.1.3'",
190+
"""sed -i '' -e "600,700s/'10_16'/os.environ['MACOSX_DEPLOYMENT_TARGET'].replace('.', '_')/" $(python -c 'import hatchling.builders.wheel as h; print(h.__file__)') """,
191+
]
181192

182193
[tool.isort]
183194
atomic = true

0 commit comments

Comments
 (0)