diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index 8fb12a2..cf051eb 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -66,12 +66,16 @@ jobs: python -m pytest tests/ --cov=primate --benchmark-skip coverage report -m - name: Build a wheel - run: | + run: | python -m pip wheel --no-deps -w wheelhouse . - delvewheel repair -w dist -v wheelhouse/*.whl + # delvewheel repair -w dist -v wheelhouse/*.whl # python -m build --wheel # $env:wheel_name=Get-ChildItem -Path dist/* -Include *.whl # delvewheel repair -w dist $env:wheel_name + - name: Repair the wheel + run: | + bash tools/repair_windows.sh + - name: Uninstall the package run: | python -m pip uninstall primate -y @@ -79,7 +83,7 @@ jobs: # python -m pip install $(find "$output_dir" -type f | grep *primate*.whl) # python -m pip install $env:wheel_name run: | - python -m pip install dist/*.whl + # python -m pip install dist/*.whl - name: Wheel dry-run run: | python -c "import primate; print(primate.__version__)" diff --git a/tools/cibw_windows.sh b/tools/cibw_windows.sh index 0023d6f..b607b45 100644 --- a/tools/cibw_windows.sh +++ b/tools/cibw_windows.sh @@ -19,7 +19,10 @@ # Get-Command rc.exe | Format-Table -AutoSize choco install rtools -y --no-progress --force --version=4.0.0.20220206 -set PATH=C:\rtools40\ucrt64\bin\;%PATH% + +export PATH=$PATH:/c/msys64/usr/bin:/c/msys64/mingw64/bin +export PATH=$PATH:/c:/rtools40/ucrt64/bin:$PATH +# set PATH=C:\rtools40\ucrt64\bin\;%PATH% g++ --version # $env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.." diff --git a/tools/repair_windows.sh b/tools/repair_windows.sh index 71328a7..2a28474 100644 --- a/tools/repair_windows.sh +++ b/tools/repair_windows.sh @@ -3,29 +3,48 @@ set -xe WHEEL="$1" DEST_DIR="$2" -## Need delvewheel for this -pip install delvewheel - -# create a temporary directory in the destination folder and unpack the wheel into there -pushd $DEST_DIR -mkdir -p tmp -pushd tmp -wheel unpack $WHEEL -pushd primate* - -# To avoid DLL hell, the file name of libopenblas that's being vendored with -# the wheel has to be name-mangled. delvewheel is unable to name-mangle PYD -# containing extra data at the end of the binary, which frequently occurs when -# building with mingw. -# We therefore find each PYD in the directory structure and strip them. -for f in $(find ./primate* -name '*.pyd'); do strip $f; done - -# now repack the wheel and overwrite the original -wheel pack . -mv -fv *.whl $WHEEL - -cd $DEST_DIR -rm -rf tmp - -# the libopenblas.dll is placed into this directory in the cibw_before_build script. -delvewheel repair -v -w $DEST_DIR $WHEEL \ No newline at end of file +strip .local/bin/*.dll + +# Make sure to leave the wheel in the same directory +wheeldir=$(dirname $WHEELNAME) +pushd $wheeldir + # Unpack the wheel and strip any .pyd DLLs inside + wheel unpack $WHEELNAME + rm $WHEELNAME + strip python_flint-*/flint/*.pyd + wheel pack python_flint-* +popd + +# 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. +delvewheel repair $WHEELNAME \ + -w $WHEELHOUSE \ + --add-path .local/bin + +# ## Need delvewheel for this +# pip install delvewheel + +# # create a temporary directory in the destination folder and unpack the wheel into there +# pushd $DEST_DIR +# mkdir -p tmp +# pushd tmp +# wheel unpack $WHEEL +# pushd primate* + +# # To avoid DLL hell, the file name of libopenblas that's being vendored with +# # the wheel has to be name-mangled. delvewheel is unable to name-mangle PYD +# # containing extra data at the end of the binary, which frequently occurs when +# # building with mingw. +# # We therefore find each PYD in the directory structure and strip them. +# for f in $(find ./primate* -name '*.pyd'); do strip $f; done + +# # now repack the wheel and overwrite the original +# wheel pack . +# mv -fv *.whl $WHEEL + +# cd $DEST_DIR +# rm -rf tmp + +# # the libopenblas.dll is placed into this directory in the cibw_before_build script. +# delvewheel repair -v -w $DEST_DIR $WHEEL \ No newline at end of file