Skip to content

Update cibuildwheel #23146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,61 +52,60 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'

- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.1.1

- name: Build wheels for CPython 3.10
run: |
python -m cibuildwheel --output-dir dist
uses: pypa/cibuildwheel@v2.7.0
env:
CIBW_BUILD: "cp310-*"
CIBW_SKIP: "*-musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy
CIBW_BEFORE_BUILD: >-
pip install certifi oldest-supported-numpy &&
git clean -fxd build
MPL_DISABLE_FH4: "yes"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for CPython 3.9
run: |
python -m cibuildwheel --output-dir dist
uses: pypa/cibuildwheel@v2.7.0
env:
CIBW_BUILD: "cp39-*"
CIBW_SKIP: "*-musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
CIBW_MANYLINUX_I686_IMAGE: manylinux1
CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy
CIBW_BEFORE_BUILD: >-
pip install certifi oldest-supported-numpy &&
git clean -fxd build
MPL_DISABLE_FH4: "yes"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for CPython 3.8
run: |
python -m cibuildwheel --output-dir dist
uses: pypa/cibuildwheel@v2.7.0
env:
CIBW_BUILD: "cp38-*"
CIBW_SKIP: "*-musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
CIBW_MANYLINUX_I686_IMAGE: manylinux1
CIBW_BEFORE_BUILD: pip install certifi numpy==1.19.2
CIBW_BEFORE_BUILD: >-
pip install certifi numpy==1.19.2 &&
git clean -fxd build
MPL_DISABLE_FH4: "yes"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for PyPy
run: |
python -m cibuildwheel --output-dir dist
uses: pypa/cibuildwheel@v2.7.0
env:
CIBW_BUILD: "pp38-*"
CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy
CIBW_SKIP: "*-musllinux*"
CIBW_BEFORE_BUILD: >-
pip install certifi oldest-supported-numpy &&
git clean -fxd build
CIBW_ARCHS: ${{ matrix.cibw_archs }}
PIP_USE_FEATURE: in-tree-build
if: false && matrix.cibw_archs != 'aarch64'

- name: Validate that LICENSE files are included in wheels
run: |
python ./ci/check_wheel_licenses.py
python3 ./ci/check_wheel_licenses.py

- uses: actions/upload-artifact@v3
with:
Expand Down
21 changes: 19 additions & 2 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import sys
import sysconfig
import tarfile
from tempfile import TemporaryDirectory
import textwrap
import urllib.request

Expand Down Expand Up @@ -691,15 +692,31 @@ def do_custom_build(self, env):
f.write(vcxproj)

cc = get_ccompiler()
cc.initialize() # Get msbuild in the %PATH% of cc.spawn.
cc.initialize()
# On setuptools versions that use "local" distutils,
# ``cc.spawn(["msbuild", ...])`` no longer manages to locate the
# right executable, even though they are correctly on the PATH,
# because only the env kwarg to Popen() is updated, and not
# os.environ["PATH"]. Instead, use shutil.which to walk the PATH
# and get absolute executable paths.
with TemporaryDirectory() as tmpdir:
dest = Path(tmpdir, "path")
cc.spawn([
sys.executable, "-c",
"import pathlib, shutil, sys\n"
"dest = pathlib.Path(sys.argv[1])\n"
"dest.write_text(shutil.which('msbuild'))\n",
str(dest),
])
msbuild_path = dest.read_text()
# Freetype 2.10.0+ support static builds.
msbuild_config = (
"Release Static"
if [*map(int, LOCAL_FREETYPE_VERSION.split("."))] >= [2, 10]
else "Release"
)

cc.spawn(["msbuild", str(sln_path),
cc.spawn([msbuild_path, str(sln_path),
"/t:Clean;Build",
f"/p:Configuration={msbuild_config};"
f"Platform={msbuild_platform}"])
Expand Down