| 1 | set -xe |
| 2 | |
| 3 | WHEEL="$1" |
| 4 | DEST_DIR="$2" |
| 5 | |
| 6 | # create a temporary directory in the destination folder and unpack the wheel |
| 7 | # into there |
| 8 | pushd $DEST_DIR |
| 9 | mkdir -p tmp |
| 10 | pushd tmp |
| 11 | wheel unpack $WHEEL |
| 12 | pushd scikit_misc* |
| 13 | |
| 14 | # To avoid DLL hell, the file name of libopenblas that's being vendored with |
| 15 | # the wheel has to be name-mangled. delvewheel is unable to name-mangle PYD |
| 16 | # containing extra data at the end of the binary, which frequently occurs when |
| 17 | # building with mingw. |
| 18 | # We therefore find each PYD in the directory structure and strip them. |
| 19 | |
| 20 | for f in $(find ./skmisc* -name '*.pyd'); do strip $f; done |
| 21 | |
| 22 | |
| 23 | # now repack the wheel and overwrite the original |
| 24 | wheel pack . |
| 25 | mv -fv *.whl $WHEEL |
| 26 | |
| 27 | cd $DEST_DIR |
| 28 | rm -rf tmp |
| 29 | |
| 30 | # the libopenblas.dll is placed into this directory in the cibw_before_build |
| 31 | # script. |
| 32 | delvewheel repair --add-path /c/opt/openblas/openblas_dll -w $DEST_DIR $WHEEL |