From d5852bd338a1a2e469a826acd05ed4bb7ba7c63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20And=C3=A9n?= Date: Mon, 18 Dec 2023 20:15:45 +0100 Subject: [PATCH] ci: move from `distutils` to `setuptools` Since `distutils` is removed from the standard library in Python 3.12, we need to switch to using the vendored version of `distutils` found in `setuptools._distutils`. Also, we make sure `setuptools` and friends are upgraded before patching and separate this from the library installation. --- .github/workflows/python_build_win.ps1 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python_build_win.ps1 b/.github/workflows/python_build_win.ps1 index 072413d42..a17edf6bc 100644 --- a/.github/workflows/python_build_win.ps1 +++ b/.github/workflows/python_build_win.ps1 @@ -12,18 +12,20 @@ Add-Content -Path make.inc -Value "FFLAGS+= -fallow-argument-mismatch -march=x86 Add-Content -Path make.inc -Value "CFLAGS+= -march=x86-64" Add-Content -Path make.inc -Value "CXXFLAGS+= -march=x86-64" +Set-Variable libvcruntime140_a -Value ([IO.Path]::Combine((Split-Path -Path $PYTHON), "libs", 'libvcruntime140.a')) +Copy-Item -Path .\.github\workflows\libvcruntime140.a -Destination $libvcruntime140_a + +python -m pip install --upgrade setuptools wheel numpy pip +if (-not $?) {throw "Failed pip install"} + # mingw gcc compiler pacth to work with python -Set-Variable cygwinccompiler_py -Value ([IO.Path]::Combine((Split-Path -Path $PYTHON), "Lib", 'distutils', 'cygwinccompiler.py')) +Set-Variable cygwinccompiler_py -Value ([IO.Path]::Combine((Split-Path -Path $PYTHON), "lib", "site-packages", "setuptools", "_distutils", "cygwinccompiler.py")) Remove-Item -Path $cygwinccompiler_py -Force Copy-Item -Path .\.github\workflows\cygwinccompiler.py -Destination $cygwinccompiler_py -Set-Variable libvcruntime140_a -Value ([IO.Path]::Combine((Split-Path -Path $PYTHON), "libs", 'libvcruntime140.a')) -Copy-Item -Path .\.github\workflows\libvcruntime140.a -Destination $libvcruntime140_a # Setup the distutils.cfg file -Set-Variable distutils_cfg -Value ([IO.Path]::Combine((Split-Path -Path $PYTHON), "Lib", 'distutils', 'distutils.cfg')) +Set-Variable distutils_cfg -Value ([IO.Path]::Combine((Split-Path -Path $PYTHON), "lib", "site-packages", "setuptools", "_distutils", "distutils.cfg")) Set-Content -Path $distutils_cfg -Value "[build]`r`ncompiler=mingw32`r`n[build_ext]`r`ncompiler=mingw32" -python -m pip install --upgrade setuptools wheel numpy pip -if (-not $?) {throw "Failed pip install"} # call make Set-Variable repo_root -Value ([IO.Path]::Combine($PSScriptRoot, '..', '..'))