Skip to content

Commit

Permalink
windows fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtuck committed May 26, 2024
1 parent 5b22afb commit 2bffa4c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/cibw_before_build_win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/')"
python -c "import bin.openblas_support as obs; obs.reformat_pkg_file('C:/opt/')"
32 changes: 32 additions & 0 deletions bin/repair_windows.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2bffa4c

Please sign in to comment.