Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 89331ee

Browse files
authored
Merge pull request #23146 from QuLogic/update-cibuildwheel
Update cibuildwheel
2 parents 386d615 + 325e547 commit 89331ee

File tree

2 files changed

+40
-24
lines changed

2 files changed

+40
-24
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,61 +52,60 @@ jobs:
5252
with:
5353
fetch-depth: 0
5454

55-
- uses: actions/setup-python@v4
56-
name: Install Python
57-
with:
58-
python-version: '3.8'
59-
60-
- name: Install cibuildwheel
61-
run: |
62-
python -m pip install cibuildwheel==2.1.1
63-
6455
- name: Build wheels for CPython 3.10
65-
run: |
66-
python -m cibuildwheel --output-dir dist
56+
uses: pypa/[email protected]
6757
env:
6858
CIBW_BUILD: "cp310-*"
59+
CIBW_SKIP: "*-musllinux*"
6960
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
7061
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
71-
CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy
62+
CIBW_BEFORE_BUILD: >-
63+
pip install certifi oldest-supported-numpy &&
64+
git clean -fxd build
7265
MPL_DISABLE_FH4: "yes"
7366
CIBW_ARCHS: ${{ matrix.cibw_archs }}
7467

7568
- name: Build wheels for CPython 3.9
76-
run: |
77-
python -m cibuildwheel --output-dir dist
69+
uses: pypa/[email protected]
7870
env:
7971
CIBW_BUILD: "cp39-*"
72+
CIBW_SKIP: "*-musllinux*"
8073
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
8174
CIBW_MANYLINUX_I686_IMAGE: manylinux1
82-
CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy
75+
CIBW_BEFORE_BUILD: >-
76+
pip install certifi oldest-supported-numpy &&
77+
git clean -fxd build
8378
MPL_DISABLE_FH4: "yes"
8479
CIBW_ARCHS: ${{ matrix.cibw_archs }}
8580

8681
- name: Build wheels for CPython 3.8
87-
run: |
88-
python -m cibuildwheel --output-dir dist
82+
uses: pypa/[email protected]
8983
env:
9084
CIBW_BUILD: "cp38-*"
85+
CIBW_SKIP: "*-musllinux*"
9186
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
9287
CIBW_MANYLINUX_I686_IMAGE: manylinux1
93-
CIBW_BEFORE_BUILD: pip install certifi numpy==1.19.2
88+
CIBW_BEFORE_BUILD: >-
89+
pip install certifi numpy==1.19.2 &&
90+
git clean -fxd build
9491
MPL_DISABLE_FH4: "yes"
9592
CIBW_ARCHS: ${{ matrix.cibw_archs }}
9693

9794
- name: Build wheels for PyPy
98-
run: |
99-
python -m cibuildwheel --output-dir dist
95+
uses: pypa/[email protected]
10096
env:
10197
CIBW_BUILD: "pp38-*"
102-
CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy
98+
CIBW_SKIP: "*-musllinux*"
99+
CIBW_BEFORE_BUILD: >-
100+
pip install certifi oldest-supported-numpy &&
101+
git clean -fxd build
103102
CIBW_ARCHS: ${{ matrix.cibw_archs }}
104103
PIP_USE_FEATURE: in-tree-build
105104
if: false && matrix.cibw_archs != 'aarch64'
106105

107106
- name: Validate that LICENSE files are included in wheels
108107
run: |
109-
python ./ci/check_wheel_licenses.py
108+
python3 ./ci/check_wheel_licenses.py
110109
111110
- uses: actions/upload-artifact@v3
112111
with:

setupext.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import sys
1313
import sysconfig
1414
import tarfile
15+
from tempfile import TemporaryDirectory
1516
import textwrap
1617
import urllib.request
1718

@@ -691,15 +692,31 @@ def do_custom_build(self, env):
691692
f.write(vcxproj)
692693

693694
cc = get_ccompiler()
694-
cc.initialize() # Get msbuild in the %PATH% of cc.spawn.
695+
cc.initialize()
696+
# On setuptools versions that use "local" distutils,
697+
# ``cc.spawn(["msbuild", ...])`` no longer manages to locate the
698+
# right executable, even though they are correctly on the PATH,
699+
# because only the env kwarg to Popen() is updated, and not
700+
# os.environ["PATH"]. Instead, use shutil.which to walk the PATH
701+
# and get absolute executable paths.
702+
with TemporaryDirectory() as tmpdir:
703+
dest = Path(tmpdir, "path")
704+
cc.spawn([
705+
sys.executable, "-c",
706+
"import pathlib, shutil, sys\n"
707+
"dest = pathlib.Path(sys.argv[1])\n"
708+
"dest.write_text(shutil.which('msbuild'))\n",
709+
str(dest),
710+
])
711+
msbuild_path = dest.read_text()
695712
# Freetype 2.10.0+ support static builds.
696713
msbuild_config = (
697714
"Release Static"
698715
if [*map(int, LOCAL_FREETYPE_VERSION.split("."))] >= [2, 10]
699716
else "Release"
700717
)
701718

702-
cc.spawn(["msbuild", str(sln_path),
719+
cc.spawn([msbuild_path, str(sln_path),
703720
"/t:Clean;Build",
704721
f"/p:Configuration={msbuild_config};"
705722
f"Platform={msbuild_platform}"])

0 commit comments

Comments
 (0)