-
-
Notifications
You must be signed in to change notification settings - Fork 649
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set _PYTHON_HOST_PLATFORM when building wheels in CI (#21942)
This follows the lead of `cibuildwheel` to explicitly correctly tag our wheels on macOS, via the `_PYTHON_HOST_PLATFORM` environment variable. This change ensures that the `pip` understands which platform each wheel is built for and compatible with, and thus external plugins using `pants_requirements(...)` work again. It appears the file name (including platform) tags of a wheel are derived from `sysconfig.get_platform()`, i.e. based on the build configuration of the current Python interpreter. Pants builds single platform wheels, so the wheels need to be tagged with the right CPU architecture. In #21655, we changed from tagging correctly to tagging incorrectly: - Before that change, our self-hosted runners had 'simple' Python interpreters, built for the current platform via Pyenv. `python -c 'import sysconfig; print(sysconfig.get_platform())' reports `macosx-10.15-x86_64` and `macosx-11.6-arm64`, and indeed the wheels were tagged like that. - After that change, we started using Python interpreters provided by GitHub-hosted runners. The interpreters report `macosx-10.9-universal2` on both the ARM64 and x86-64 runners. That is, they're built as universal binaries that can run on either architecture. This lead to the wheels being tagged as `universal2` as well. The `_PYTHON_HOST_PLATFORM` environment variable overrides the default `sysconfig.get_platform()` value, and appears to be designed for this sort of purpose (and is used by `cibuildwheel` for such): - https://github.com/python/cpython/blob/5505b91a684b0fc7ffcb3a5b325302671d74fb15/Lib/sysconfig.py#L652-L654 - https://github.com/pypa/cibuildwheel/blob/3805787fe7a0476391541d834fa548a721f0ab2e/cibuildwheel/macos.py#L318-L331 Fixes #21938
- Loading branch information
1 parent
97ab19d
commit c64028a
Showing
5 changed files
with
50 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters