From 2b14fcfffa25ba3212323dd4925da3d0609e4b3e Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 21 Dec 2022 14:58:09 +0000 Subject: [PATCH 01/22] maint: use msys2-ucrt instead of msys2-mingw64 --- .github/workflows/buildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index f8b4dd13..acf5d8c7 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -21,7 +21,7 @@ jobs: - uses: msys2/setup-msys2@v2 with: - msystem: mingw64 + msystem: ucrt64 # path-type inherit is used so that when cibuildwheel calls msys2 to # run bin/cibw_before_build_windows.sh the virtual environment # created by cibuildwheel will be available within msys2. The From 0cb165af7472007ea23081135628efe008d19c97 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 21 Dec 2022 17:15:09 +0000 Subject: [PATCH 02/22] maint: use mingw-ucrt toolchain --- bin/cibw_before_all_windows.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index ea2f8a89..41d86978 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -14,7 +14,10 @@ echo 'compiler = mingw32' >> setup.cfg cat setup.cfg # Install the mingw-w64 toolchain -pacman -S --noconfirm mingw-w64-x86_64-gcc m4 make mingw-w64-x86_64-tools-git +# pacman -S --noconfirm mingw-w64-x86_64-gcc m4 make mingw-w64-x86_64-tools-git + +# Install the mingw-ucrt toolchain +pacman -S --noconfirm mingw-w64-ucrt-x86_64-gcc m4 make mingw-w64-ucrt-x86_64-tools-git # This takes ~30mins bin/build_dependencies_unix.sh From 87192c703ed5a51813a7f45bf53156cd24a4c2a1 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 21 Dec 2022 17:29:21 +0000 Subject: [PATCH 03/22] maint: add verbose output to delvewheel --- bin/cibw_repair_wheel_command_windows.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/cibw_repair_wheel_command_windows.sh b/bin/cibw_repair_wheel_command_windows.sh index c4827867..03e81bf6 100755 --- a/bin/cibw_repair_wheel_command_windows.sh +++ b/bin/cibw_repair_wheel_command_windows.sh @@ -46,5 +46,6 @@ popd # --no-mangle if strip has not been applied to all mingw64-created .dll and # .pyd files that are needed for the wheel. delvewheel repair $WHEELNAME \ - -w $WHEELHOUSE \ - --add-path .local/bin:.local/lib/ + -vv \ + -w $WHEELHOUSE \ + --add-path .local/bin:.local/lib/ From 684ab32c456b23ec9b4f4bd02acea5ee4f357a25 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 21 Dec 2022 22:39:03 +0000 Subject: [PATCH 04/22] set build explicitly --- bin/build_dependencies_unix.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index 8524a34a..f98d229d 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -80,7 +80,8 @@ if [ $USE_GMP = "gmp" ]; then --enable-fat\ --enable-shared=yes\ --enable-static=no\ - --host=$HOSTARG + --host=$HOSTARG\ + --build=x86_64-w64-mingw64 make -j3 make install cd .. From a36a6d5a930afd96a71a07799e7d1d9d0bc4d6d7 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 12:40:30 +0000 Subject: [PATCH 05/22] use ucrt64 --- .github/workflows/buildwheel.yml | 5 +++++ bin/cibw_before_all_windows.sh | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index acf5d8c7..ccc07ac9 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -29,6 +29,11 @@ jobs: # problematic in some situations. Maybe there is a better way to do # this. path-type: inherit + install: >- + m4 + make + mingw-w64-ucrt-x86_64-gcc + mingw-w64-ucrt-x86_64-tools-git if: ${{ matrix.os == 'windows-2019' }} - name: Build wheels diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index 41d86978..fbd5cf1f 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -13,11 +13,14 @@ echo '[build]' > setup.cfg echo 'compiler = mingw32' >> setup.cfg cat setup.cfg +echo "NEED UCRT64 gcc:" +which gcc + # Install the mingw-w64 toolchain # pacman -S --noconfirm mingw-w64-x86_64-gcc m4 make mingw-w64-x86_64-tools-git # Install the mingw-ucrt toolchain -pacman -S --noconfirm mingw-w64-ucrt-x86_64-gcc m4 make mingw-w64-ucrt-x86_64-tools-git +# pacman -S --noconfirm mingw-w64-ucrt-x86_64-gcc m4 make mingw-w64-ucrt-x86_64-tools-git # This takes ~30mins bin/build_dependencies_unix.sh From 58691153c47f64caa4cf917b81c5c96f59f51235 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 12:42:57 +0000 Subject: [PATCH 06/22] fix yml syntax --- .github/workflows/buildwheel.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index ccc07ac9..11f79f73 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -29,11 +29,11 @@ jobs: # problematic in some situations. Maybe there is a better way to do # this. path-type: inherit - install: >- - m4 - make - mingw-w64-ucrt-x86_64-gcc - mingw-w64-ucrt-x86_64-tools-git + install: >- + m4 + make + mingw-w64-ucrt-x86_64-gcc + mingw-w64-ucrt-x86_64-tools-git if: ${{ matrix.os == 'windows-2019' }} - name: Build wheels From 065d9b110540985a54675d2a8f083fbd7cd8a9aa Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 12:47:09 +0000 Subject: [PATCH 07/22] show PATH --- bin/cibw_before_all_windows.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/cibw_before_all_windows.sh b/bin/cibw_before_all_windows.sh index fbd5cf1f..df96936b 100755 --- a/bin/cibw_before_all_windows.sh +++ b/bin/cibw_before_all_windows.sh @@ -16,6 +16,8 @@ cat setup.cfg echo "NEED UCRT64 gcc:" which gcc +echo $PATH + # Install the mingw-w64 toolchain # pacman -S --noconfirm mingw-w64-x86_64-gcc m4 make mingw-w64-x86_64-tools-git From 5045fa820a83f3da0280f05a49bb85c82fcbe1c3 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 12:57:24 +0000 Subject: [PATCH 08/22] set path manually --- .github/workflows/buildwheel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 11f79f73..932156c2 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -54,6 +54,7 @@ jobs: LIBRARY_PATH=$(pwd)/.local/lib/ LD_LIBRARY_PATH=$(pwd)/.local/lib:$LD_LIBRARY_PATH PYTHON_FLINT_MINGW64=true + PATH=/c/msys64/ucrt64/bin:$PATH CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel} CIBW_TEST_COMMAND: python -c "import flint; print(str(flint.fmpz(2)))" From ca107f4ff3e75d798ddaeba3709aecfca4ee5970 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 13:03:19 +0000 Subject: [PATCH 09/22] set path again --- .github/workflows/buildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 932156c2..33996ccb 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -54,7 +54,7 @@ jobs: LIBRARY_PATH=$(pwd)/.local/lib/ LD_LIBRARY_PATH=$(pwd)/.local/lib:$LD_LIBRARY_PATH PYTHON_FLINT_MINGW64=true - PATH=/c/msys64/ucrt64/bin:$PATH + PATH=/ucrt64/bin:$PATH CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel} CIBW_TEST_COMMAND: python -c "import flint; print(str(flint.fmpz(2)))" From d0f78bd73530d28af577a1323c34a4920d7614a6 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 13:08:03 +0000 Subject: [PATCH 10/22] remove --build --- bin/build_dependencies_unix.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index f98d229d..0f09f5b7 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -81,7 +81,6 @@ if [ $USE_GMP = "gmp" ]; then --enable-shared=yes\ --enable-static=no\ --host=$HOSTARG\ - --build=x86_64-w64-mingw64 make -j3 make install cd .. From 8219cecb795fc3981568ee416addb5df87251197 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 13:11:54 +0000 Subject: [PATCH 11/22] remove slash --- bin/build_dependencies_unix.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index 0f09f5b7..8524a34a 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -80,7 +80,7 @@ if [ $USE_GMP = "gmp" ]; then --enable-fat\ --enable-shared=yes\ --enable-static=no\ - --host=$HOSTARG\ + --host=$HOSTARG make -j3 make install cd .. From a5aa08fbfd1866734716f8dbe442ba67c8ab24d5 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 13:16:16 +0000 Subject: [PATCH 12/22] don't inherit path --- .github/workflows/buildwheel.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 33996ccb..089bb590 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -28,7 +28,7 @@ jobs: # msys2/setup-msys2 README warns that using inherit here can be # problematic in some situations. Maybe there is a better way to do # this. - path-type: inherit + #path-type: inherit install: >- m4 make @@ -54,7 +54,6 @@ jobs: LIBRARY_PATH=$(pwd)/.local/lib/ LD_LIBRARY_PATH=$(pwd)/.local/lib:$LD_LIBRARY_PATH PYTHON_FLINT_MINGW64=true - PATH=/ucrt64/bin:$PATH CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel} CIBW_TEST_COMMAND: python -c "import flint; print(str(flint.fmpz(2)))" From f7860e3a0c11510a477502d3cbb26d473b512063 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 13:21:10 +0000 Subject: [PATCH 13/22] try using bash --- .github/workflows/buildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 089bb590..033824a6 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -46,7 +46,7 @@ jobs: CIBW_MANYLINUX_I686_IMAGE: manylinux2014 CIBW_BEFORE_ALL_LINUX: bin/cibw_before_all_linux.sh CIBW_BEFORE_ALL_MACOS: bin/cibw_before_all_macosx.sh - CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh + CIBW_BEFORE_ALL_WINDOWS: bash bin/cibw_before_all_windows.sh CIBW_BEFORE_BUILD_WINDOWS: msys2 -c bin/cibw_before_build_windows.sh CIBW_BEFORE_BUILD: pip install numpy cython delvewheel CIBW_ENVIRONMENT: > From 7bdf9a7aad5403f24f1c25d27d57a3f623228532 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 13:25:12 +0000 Subject: [PATCH 14/22] don't use bash --- .github/workflows/buildwheel.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 033824a6..2ac3f1bb 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -46,7 +46,7 @@ jobs: CIBW_MANYLINUX_I686_IMAGE: manylinux2014 CIBW_BEFORE_ALL_LINUX: bin/cibw_before_all_linux.sh CIBW_BEFORE_ALL_MACOS: bin/cibw_before_all_macosx.sh - CIBW_BEFORE_ALL_WINDOWS: bash bin/cibw_before_all_windows.sh + CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh CIBW_BEFORE_BUILD_WINDOWS: msys2 -c bin/cibw_before_build_windows.sh CIBW_BEFORE_BUILD: pip install numpy cython delvewheel CIBW_ENVIRONMENT: > @@ -54,6 +54,7 @@ jobs: LIBRARY_PATH=$(pwd)/.local/lib/ LD_LIBRARY_PATH=$(pwd)/.local/lib:$LD_LIBRARY_PATH PYTHON_FLINT_MINGW64=true + PATH=/mingw64/ucrt64/bin:${PATH} CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel} CIBW_TEST_COMMAND: python -c "import flint; print(str(flint.fmpz(2)))" From 05893453f222635cf5ae4ef321c5c7fdb5ababd0 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 13:30:14 +0000 Subject: [PATCH 15/22] fix path --- .github/workflows/buildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 2ac3f1bb..9cea75a5 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -54,7 +54,7 @@ jobs: LIBRARY_PATH=$(pwd)/.local/lib/ LD_LIBRARY_PATH=$(pwd)/.local/lib:$LD_LIBRARY_PATH PYTHON_FLINT_MINGW64=true - PATH=/mingw64/ucrt64/bin:${PATH} + PATH=/ucrt64/bin:${PATH} CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel} CIBW_TEST_COMMAND: python -c "import flint; print(str(flint.fmpz(2)))" From b7df8b787005b6fd3dadd6bf931cb13a2b6ea2b7 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 14:19:50 +0000 Subject: [PATCH 16/22] set MSYSTEM --- .github/workflows/buildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 9cea75a5..4ca5db1b 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -54,7 +54,7 @@ jobs: LIBRARY_PATH=$(pwd)/.local/lib/ LD_LIBRARY_PATH=$(pwd)/.local/lib:$LD_LIBRARY_PATH PYTHON_FLINT_MINGW64=true - PATH=/ucrt64/bin:${PATH} + MSYSTEM=UCRT64 CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel} CIBW_TEST_COMMAND: python -c "import flint; print(str(flint.fmpz(2)))" From d8fe093c18f29ca8b2a69af1f1ee7d6fabd976e1 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 15:07:52 +0000 Subject: [PATCH 17/22] add venv to PATH --- bin/cibw_before_build_windows.sh | 4 ++++ bin/cibw_repair_wheel_command_windows.sh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/bin/cibw_before_build_windows.sh b/bin/cibw_before_build_windows.sh index d0410b35..7a06eda2 100644 --- a/bin/cibw_before_build_windows.sh +++ b/bin/cibw_before_build_windows.sh @@ -5,6 +5,10 @@ set -o errexit # Uncomment this to run cibuildwheel locally on Windows: # export PATH=$PATH:/c/msys64/usr/bin:/c/msys64/mingw64/bin +# msys2 will not inherit the PATH for the virtual environment in CI +export PATH=$PATH:$VIRTUAL_ENV/Scripts +echo PATH=$PATH + # VER should be set be e.g. 310 for Python 3.10 VER=`python -c 'import sys; print("%s%s" % sys.version_info[:2])'` echo VER=${VER} diff --git a/bin/cibw_repair_wheel_command_windows.sh b/bin/cibw_repair_wheel_command_windows.sh index 03e81bf6..f9eb449d 100755 --- a/bin/cibw_repair_wheel_command_windows.sh +++ b/bin/cibw_repair_wheel_command_windows.sh @@ -42,6 +42,10 @@ pushd $wheeldir wheel pack python_flint-* popd +# msys2 will not inherit the PATH for the virtual environment in CI +export PATH=$PATH:$VIRTUAL_ENV/Scripts +echo PATH=$PATH + # Make the wheel relocatable. This will fail with an error message about # --no-mangle if strip has not been applied to all mingw64-created .dll and # .pyd files that are needed for the wheel. From 48543374d7a63b1c910a3266d84ff841ee49ebdf Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 20:04:44 +0000 Subject: [PATCH 18/22] workaround to add venv path --- .github/workflows/buildwheel.yml | 2 +- bin/cibw.bat | 8 +++++--- bin/cibw_before_build_windows.bat | 6 ++++++ bin/cibw_before_build_windows.sh | 9 +++++---- bin/cibw_repair_wheel_command_windows.bat | 5 +++++ bin/cibw_repair_wheel_command_windows.sh | 9 +++++---- 6 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 bin/cibw_before_build_windows.bat diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 4ca5db1b..29457fc4 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -47,7 +47,7 @@ jobs: CIBW_BEFORE_ALL_LINUX: bin/cibw_before_all_linux.sh CIBW_BEFORE_ALL_MACOS: bin/cibw_before_all_macosx.sh CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh - CIBW_BEFORE_BUILD_WINDOWS: msys2 -c bin/cibw_before_build_windows.sh + CIBW_BEFORE_BUILD_WINDOWS: bin/cibw_before_build_windows.bat CIBW_BEFORE_BUILD: pip install numpy cython delvewheel CIBW_ENVIRONMENT: > C_INCLUDE_PATH=$(pwd)/.local/include/ diff --git a/bin/cibw.bat b/bin/cibw.bat index a21ebb6d..28dc63dd 100644 --- a/bin/cibw.bat +++ b/bin/cibw.bat @@ -23,9 +23,11 @@ del /q wheelhouse\* set CIBW_BUILD=cp39-* cp310-* cp311-* set CIBW_SKIP=*-win32 *-manylinux_i686 *-musllinux_* -set CIBW_BEFORE_ALL_WINDOWS=C:\msys64\usr\bin\bash bin/cibw_before_all_windows.sh -set CIBW_BEFORE_BUILD_WINDOWS=C:\msys64\usr\bin\bash bin/cibw_before_build_windows.sh -set CIBW_ENVIRONMENT=PYTHON_FLINT_MINGW64=true +set CIBW_BEFORE_ALL_WINDOWS=msys2 -c bin/cibw_before_all_windows.sh +set CIBW_BEFORE_BUILD_WINDOWS=bin\cibw_before_build_windows.bat +set CIBW_ENVIRONMENT=^ + PYTHON_FLINT_MINGW64=true ^ + MSYSTEM=UCRT64 set CIBW_REPAIR_WHEEL_COMMAND_WINDOWS=bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel} set CIBW_TEST_COMMAND=python -c "import flint; print(str(flint.fmpz(2)))" diff --git a/bin/cibw_before_build_windows.bat b/bin/cibw_before_build_windows.bat new file mode 100644 index 00000000..ff45fb4d --- /dev/null +++ b/bin/cibw_before_build_windows.bat @@ -0,0 +1,6 @@ +SET +FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "import sys, os; print(os.path.dirname(sys.executable))"`) DO ( + SET VIRTUAL_ENV_BIN=%%F +) +echo %VIRTUAL_ENV_BIN% +msys2 -c bin/cibw_before_build_windows.sh diff --git a/bin/cibw_before_build_windows.sh b/bin/cibw_before_build_windows.sh index 7a06eda2..4e0005e5 100644 --- a/bin/cibw_before_build_windows.sh +++ b/bin/cibw_before_build_windows.sh @@ -5,8 +5,8 @@ set -o errexit # Uncomment this to run cibuildwheel locally on Windows: # export PATH=$PATH:/c/msys64/usr/bin:/c/msys64/mingw64/bin -# msys2 will not inherit the PATH for the virtual environment in CI -export PATH=$PATH:$VIRTUAL_ENV/Scripts +# msys2 will not inherit the PATH for the virtual environment +export PATH=$PATH:$VIRTUAL_ENV_BIN echo PATH=$PATH # VER should be set be e.g. 310 for Python 3.10 @@ -18,7 +18,8 @@ echo VER=${VER} ################################################### which python -PYTHONBIN=`dirname $(which python)` +PYTHONBIN=$VIRTUAL_ENV_BIN +echo PYTHONBIN=$PYTHONBIN PYTHONDIR=`dirname $PYTHONBIN` cfgfile=$PYTHONDIR/pyvenv.cfg homeline=`grep home $cfgfile` @@ -44,4 +45,4 @@ mv libpython${VER}.a libs # Install build dependencies # ################################################### -pip install Cython numpy delvewheel +pip install Cython numpy delvewheel wheel diff --git a/bin/cibw_repair_wheel_command_windows.bat b/bin/cibw_repair_wheel_command_windows.bat index 00e7d151..b136f171 100644 --- a/bin/cibw_repair_wheel_command_windows.bat +++ b/bin/cibw_repair_wheel_command_windows.bat @@ -9,5 +9,10 @@ set tempfile=tmpfile.deleteme set WHEELHOUSE=%1 set WHEELNAME=%2 +FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "import sys, os; print(os.path.dirname(sys.executable))"`) DO ( + SET VIRTUAL_ENV_BIN=%%F +) +echo %VIRTUAL_ENV_BIN% + msys2 -c bin/cibw_repair_wheel_command_windows.sh rem C:\msys64\usr\bin\bash bin/cibw_repair_wheel_command_windows.sh diff --git a/bin/cibw_repair_wheel_command_windows.sh b/bin/cibw_repair_wheel_command_windows.sh index f9eb449d..09bf2c22 100755 --- a/bin/cibw_repair_wheel_command_windows.sh +++ b/bin/cibw_repair_wheel_command_windows.sh @@ -9,6 +9,11 @@ set -o errexit # Uncomment this to run cibuildwheel locally on Windows: # export PATH=$PATH:/c/msys64/usr/bin:/c/msys64/mingw64/bin +# msys2 will not inherit the PATH for the virtual environment in CI +export PATH=$PATH:$VIRTUAL_ENV_BIN +echo PATH=$PATH + + # We cannot use ordinary command line arguments in CI because msys2 -c mangles # them. Instead we have a batch file to receive the arguments and convert them # into environment variables before calling this script. When running locally @@ -42,10 +47,6 @@ pushd $wheeldir wheel pack python_flint-* popd -# msys2 will not inherit the PATH for the virtual environment in CI -export PATH=$PATH:$VIRTUAL_ENV/Scripts -echo PATH=$PATH - # Make the wheel relocatable. This will fail with an error message about # --no-mangle if strip has not been applied to all mingw64-created .dll and # .pyd files that are needed for the wheel. From a73b911f09c3d17c8b544e36ac95ed2c8c4d20f9 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 21:07:40 +0000 Subject: [PATCH 19/22] fix slash --- .github/workflows/buildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 29457fc4..18fa1d8e 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -47,7 +47,7 @@ jobs: CIBW_BEFORE_ALL_LINUX: bin/cibw_before_all_linux.sh CIBW_BEFORE_ALL_MACOS: bin/cibw_before_all_macosx.sh CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh - CIBW_BEFORE_BUILD_WINDOWS: bin/cibw_before_build_windows.bat + CIBW_BEFORE_BUILD_WINDOWS: bin\cibw_before_build_windows.bat CIBW_BEFORE_BUILD: pip install numpy cython delvewheel CIBW_ENVIRONMENT: > C_INCLUDE_PATH=$(pwd)/.local/include/ From 6298d16fdf7f2e03dd0dbf364b2d78aa9f3bcdea Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Thu, 22 Dec 2022 22:06:39 +0000 Subject: [PATCH 20/22] fix PATH --- bin/cibw_before_build_windows.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cibw_before_build_windows.sh b/bin/cibw_before_build_windows.sh index 4e0005e5..a3966127 100644 --- a/bin/cibw_before_build_windows.sh +++ b/bin/cibw_before_build_windows.sh @@ -6,7 +6,7 @@ set -o errexit # export PATH=$PATH:/c/msys64/usr/bin:/c/msys64/mingw64/bin # msys2 will not inherit the PATH for the virtual environment -export PATH=$PATH:$VIRTUAL_ENV_BIN +export PATH=$PATH:$(cygpath ${VIRTUAL_ENV_BIN}) echo PATH=$PATH # VER should be set be e.g. 310 for Python 3.10 From b1376ee75d6720ba8ccf3d003a220af8245f7f05 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 23 Dec 2022 17:45:34 +0000 Subject: [PATCH 21/22] add debug output --- bin/cibw_repair_wheel_command_windows.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/cibw_repair_wheel_command_windows.sh b/bin/cibw_repair_wheel_command_windows.sh index 09bf2c22..3cde5eaa 100755 --- a/bin/cibw_repair_wheel_command_windows.sh +++ b/bin/cibw_repair_wheel_command_windows.sh @@ -13,6 +13,13 @@ set -o errexit export PATH=$PATH:$VIRTUAL_ENV_BIN echo PATH=$PATH +echo of VIRTUAL_ENV_BIN=$VIRTUAL_ENV_BIN +echo Contents of VIRTUAL_ENV_BIN: +ls $VIRTUAL_ENV_BIN + +which pip +which wheel +pip list # We cannot use ordinary command line arguments in CI because msys2 -c mangles # them. Instead we have a batch file to receive the arguments and convert them @@ -53,4 +60,4 @@ popd delvewheel repair $WHEELNAME \ -vv \ -w $WHEELHOUSE \ - --add-path .local/bin:.local/lib/ + --add-path .local/bin:.local/lib/:/c/msys64/ucrt64/bin From 302d0ce5a12b5521d53540afed0cb63e429db3a7 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Fri, 23 Dec 2022 18:41:35 +0000 Subject: [PATCH 22/22] use cygpath --- bin/cibw_repair_wheel_command_windows.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cibw_repair_wheel_command_windows.sh b/bin/cibw_repair_wheel_command_windows.sh index 3cde5eaa..bb02d73f 100755 --- a/bin/cibw_repair_wheel_command_windows.sh +++ b/bin/cibw_repair_wheel_command_windows.sh @@ -10,7 +10,7 @@ set -o errexit # export PATH=$PATH:/c/msys64/usr/bin:/c/msys64/mingw64/bin # msys2 will not inherit the PATH for the virtual environment in CI -export PATH=$PATH:$VIRTUAL_ENV_BIN +export PATH=$PATH:$(cygpath ${VIRTUAL_ENV_BIN}) echo PATH=$PATH echo of VIRTUAL_ENV_BIN=$VIRTUAL_ENV_BIN