From 0dd4e58cebde86866959b41ff92552802b48945d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 25 May 2022 03:55:15 -0400 Subject: [PATCH 1/7] Switch to cibuildwheel GitHub Action ... instead of manual install and run. This should also trigger automatic dependabot alerts. --- .github/workflows/cibuildwheel.yml | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 2ba4ab5eb050..4685103c8605 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -52,18 +52,8 @@ 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.1.1 env: CIBW_BUILD: "cp310-*" CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 @@ -73,8 +63,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.9 - run: | - python -m cibuildwheel --output-dir dist + uses: pypa/cibuildwheel@v2.1.1 env: CIBW_BUILD: "cp39-*" CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 @@ -84,8 +73,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.8 - run: | - python -m cibuildwheel --output-dir dist + uses: pypa/cibuildwheel@v2.1.1 env: CIBW_BUILD: "cp38-*" CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 @@ -95,8 +83,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for PyPy - run: | - python -m cibuildwheel --output-dir dist + uses: pypa/cibuildwheel@v2.1.1 env: CIBW_BUILD: "pp38-*" CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy @@ -106,7 +93,7 @@ jobs: - 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: From 34f2b8be47f09e0a34e3b8f517f516c3658f16b1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 25 May 2022 03:04:34 -0400 Subject: [PATCH 2/7] Update cibuildwheel to 2.3.1 Because cibuildwheel switched to pip 21.3 that uses in-tree builds, we need to add an explicit clean step. This is because the FreeType built for 64-bit and 32-bit Windows are not compatible, but as they appear to be named the same, aren't rebuilt for each wheel, causing linker issues when mixed. I'm not sure it's necessary on other platforms as well, but it can't hurt. --- .github/workflows/cibuildwheel.yml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 4685103c8605..4ba941b07889 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -53,40 +53,52 @@ jobs: fetch-depth: 0 - name: Build wheels for CPython 3.10 - uses: pypa/cibuildwheel@v2.1.1 + uses: pypa/cibuildwheel@v2.3.1 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 - uses: pypa/cibuildwheel@v2.1.1 + uses: pypa/cibuildwheel@v2.3.1 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 - uses: pypa/cibuildwheel@v2.1.1 + uses: pypa/cibuildwheel@v2.3.1 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 - uses: pypa/cibuildwheel@v2.1.1 + uses: pypa/cibuildwheel@v2.3.1 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' From 518eb939eb4dc4d510676ec250816b003f13c66d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 25 May 2022 21:07:47 -0400 Subject: [PATCH 3/7] Update to cibuildwheel 2.4.0 --- .github/workflows/cibuildwheel.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 4ba941b07889..7ad8dd564ec1 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -53,7 +53,7 @@ jobs: fetch-depth: 0 - name: Build wheels for CPython 3.10 - uses: pypa/cibuildwheel@v2.3.1 + uses: pypa/cibuildwheel@v2.4.0 env: CIBW_BUILD: "cp310-*" CIBW_SKIP: "*-musllinux*" @@ -66,7 +66,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.9 - uses: pypa/cibuildwheel@v2.3.1 + uses: pypa/cibuildwheel@v2.4.0 env: CIBW_BUILD: "cp39-*" CIBW_SKIP: "*-musllinux*" @@ -79,7 +79,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.8 - uses: pypa/cibuildwheel@v2.3.1 + uses: pypa/cibuildwheel@v2.4.0 env: CIBW_BUILD: "cp38-*" CIBW_SKIP: "*-musllinux*" @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for PyPy - uses: pypa/cibuildwheel@v2.3.1 + uses: pypa/cibuildwheel@v2.4.0 env: CIBW_BUILD: "pp38-*" CIBW_SKIP: "*-musllinux*" From cd5cbb2294695edb8d25493ac123d181a5b6173c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 28 Jun 2022 20:47:32 -0400 Subject: [PATCH 4/7] Fix Windows build on setuptools that default to local distutils. This is a cross port of matplotlib/mplcairo@2991c725cd36b14a63f6353262e9a689b44769cd and matplotlib/mplcairo@2991c725cd36b14a63f6353262e9a689b44769cd Fixes #23147 Co-authored-by: Antony Lee --- setupext.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/setupext.py b/setupext.py index 0ab67839dcf1..c9f5bb5bfc2a 100644 --- a/setupext.py +++ b/setupext.py @@ -12,6 +12,7 @@ import sys import sysconfig import tarfile +from tempfile import TemporaryDirectory import textwrap import urllib.request @@ -691,7 +692,23 @@ 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" @@ -699,7 +716,7 @@ def do_custom_build(self, env): 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}"]) From 635285f43f80a075a48a0eeb935dbb6f4ad4d3e4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 25 May 2022 21:08:08 -0400 Subject: [PATCH 5/7] Update to cibuildwheel 2.5.0 --- .github/workflows/cibuildwheel.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 7ad8dd564ec1..f68fd2c0a274 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -53,7 +53,7 @@ jobs: fetch-depth: 0 - name: Build wheels for CPython 3.10 - uses: pypa/cibuildwheel@v2.4.0 + uses: pypa/cibuildwheel@v2.5.0 env: CIBW_BUILD: "cp310-*" CIBW_SKIP: "*-musllinux*" @@ -66,7 +66,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.9 - uses: pypa/cibuildwheel@v2.4.0 + uses: pypa/cibuildwheel@v2.5.0 env: CIBW_BUILD: "cp39-*" CIBW_SKIP: "*-musllinux*" @@ -79,7 +79,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.8 - uses: pypa/cibuildwheel@v2.4.0 + uses: pypa/cibuildwheel@v2.5.0 env: CIBW_BUILD: "cp38-*" CIBW_SKIP: "*-musllinux*" @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for PyPy - uses: pypa/cibuildwheel@v2.4.0 + uses: pypa/cibuildwheel@v2.5.0 env: CIBW_BUILD: "pp38-*" CIBW_SKIP: "*-musllinux*" From d953b353f54cf39167503db958a8d156139a2f15 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 25 May 2022 21:08:31 -0400 Subject: [PATCH 6/7] Update to cibuildwheel 2.6.0 --- .github/workflows/cibuildwheel.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index f68fd2c0a274..48464e85de89 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -53,7 +53,7 @@ jobs: fetch-depth: 0 - name: Build wheels for CPython 3.10 - uses: pypa/cibuildwheel@v2.5.0 + uses: pypa/cibuildwheel@v2.6.0 env: CIBW_BUILD: "cp310-*" CIBW_SKIP: "*-musllinux*" @@ -66,7 +66,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.9 - uses: pypa/cibuildwheel@v2.5.0 + uses: pypa/cibuildwheel@v2.6.0 env: CIBW_BUILD: "cp39-*" CIBW_SKIP: "*-musllinux*" @@ -79,7 +79,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.8 - uses: pypa/cibuildwheel@v2.5.0 + uses: pypa/cibuildwheel@v2.6.0 env: CIBW_BUILD: "cp38-*" CIBW_SKIP: "*-musllinux*" @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for PyPy - uses: pypa/cibuildwheel@v2.5.0 + uses: pypa/cibuildwheel@v2.6.0 env: CIBW_BUILD: "pp38-*" CIBW_SKIP: "*-musllinux*" From 325e547de385328e5c9a47ee60673091a54668f2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 29 Jun 2022 01:01:01 -0400 Subject: [PATCH 7/7] Update to cibuildwheel 2.7.0 --- .github/workflows/cibuildwheel.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 48464e85de89..74fa4feecb39 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -53,7 +53,7 @@ jobs: fetch-depth: 0 - name: Build wheels for CPython 3.10 - uses: pypa/cibuildwheel@v2.6.0 + uses: pypa/cibuildwheel@v2.7.0 env: CIBW_BUILD: "cp310-*" CIBW_SKIP: "*-musllinux*" @@ -66,7 +66,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.9 - uses: pypa/cibuildwheel@v2.6.0 + uses: pypa/cibuildwheel@v2.7.0 env: CIBW_BUILD: "cp39-*" CIBW_SKIP: "*-musllinux*" @@ -79,7 +79,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.8 - uses: pypa/cibuildwheel@v2.6.0 + uses: pypa/cibuildwheel@v2.7.0 env: CIBW_BUILD: "cp38-*" CIBW_SKIP: "*-musllinux*" @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for PyPy - uses: pypa/cibuildwheel@v2.6.0 + uses: pypa/cibuildwheel@v2.7.0 env: CIBW_BUILD: "pp38-*" CIBW_SKIP: "*-musllinux*"