From 2bffa4ca881fe4703ccffe193f9b2482c61f9032 Mon Sep 17 00:00:00 2001 From: "J. Derek Tucker" Date: Sun, 26 May 2024 04:29:24 -0600 Subject: [PATCH] windows fix --- bin/cibw_before_build_win.sh | 6 +++--- bin/repair_windows.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 bin/repair_windows.sh diff --git a/bin/cibw_before_build_win.sh b/bin/cibw_before_build_win.sh index 3741275..30cf07a 100644 --- a/bin/cibw_before_build_win.sh +++ b/bin/cibw_before_build_win.sh @@ -13,12 +13,12 @@ mkdir -p /c/opt/64/lib/pkgconfig # delvewheel is the equivalent of delocate/auditwheel for windows. python -m pip install delvewheel -# make the DLL available for tools/wheels/repair_windows.sh. If you change +# make the DLL available for bin/repair_windows.sh. If you change # this location you need to alter that script. mkdir -p /c/opt/openblas/openblas_dll which strip -target=$(python -c "import tools.openblas_support as obs; plat=obs.get_plat(); ilp64=obs.get_ilp64(); target=f'openblas_{plat}.zip'; obs.download_openblas(target, plat, ilp64);print(target)") +target=$(python -c "import bin.openblas_support as obs; plat=obs.get_plat(); ilp64=obs.get_ilp64(); target=f'openblas_{plat}.zip'; obs.download_openblas(target, plat, ilp64);print(target)") # The 32/64 bit Fortran wheels are currently coming from different locations. if [[ $PLATFORM == 'win-32' ]]; then @@ -34,4 +34,4 @@ else fi # attempt to deal with: # https://github.com/scipy/scipy/pull/20362#issuecomment-2028517797 -python -c "import tools.openblas_support as obs; obs.reformat_pkg_file('C:/opt/')" \ No newline at end of file +python -c "import bin.openblas_support as obs; obs.reformat_pkg_file('C:/opt/')" \ No newline at end of file diff --git a/bin/repair_windows.sh b/bin/repair_windows.sh new file mode 100644 index 0000000..05a5cf4 --- /dev/null +++ b/bin/repair_windows.sh @@ -0,0 +1,32 @@ +set -xe + +WHEEL="$1" +DEST_DIR="$2" + +# 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 fdsasrsf* + +# 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 ./fdasrsf* -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 --add-path /c/opt/openblas/openblas_dll --no-dll libsf_error_state.dll -w $DEST_DIR $WHEEL \ No newline at end of file