| 1 |
set -xe |
| 2 |
|
| 3 |
PROJECT_DIR="${1:-$PWD}" |
| 4 |
|
| 5 |
# remove any cruft from a previous run |
| 6 |
rm -rf build |
| 7 |
|
| 8 |
if [[ $(python -c"import sys; print(sys.maxsize)") < $(python -c"import sys; print(2**33)") ]]; then |
| 9 |
echo "No BLAS used for 32-bit wheels" |
| 10 |
export INSTALL_OPENBLAS=false |
| 11 |
elif [ -z $INSTALL_OPENBLAS ]; then |
| 12 |
# the macos_arm64 build might not set this variable |
| 13 |
export INSTALL_OPENBLAS=true |
| 14 |
fi |
| 15 |
|
| 16 |
# Install OpenBLAS from scipy-openblas32|64 |
| 17 |
if [[ "$INSTALL_OPENBLAS" = "true" ]] ; then |
| 18 |
# By default, use scipy-openblas64 |
| 19 |
# On 32-bit platforms and on win-arm64, use scipy-openblas32 |
| 20 |
OPENBLAS=openblas64 |
| 21 |
# Possible values for RUNNER_ARCH in GitHub Actions are: X86, X64, ARM, or ARM64 |
| 22 |
if [[ $RUNNER_ARCH == "X86" || $RUNNER_ARCH == "ARM" ]] ; then |
| 23 |
OPENBLAS=openblas32 |
| 24 |
elif [[ $RUNNER_ARCH == "ARM64" && $RUNNER_OS == "Windows" ]] ; then |
| 25 |
OPENBLAS=openblas32 |
| 26 |
fi |
| 27 |
|
| 28 |
# The PKG_CONFIG_PATH environment variable will be pointed to this path in |
| 29 |
# pyproject.toml and .github/workflows/wheels.yml. Note that |
| 30 |
# `pkgconf_path` here is only a bash variable local to this file. |
| 31 |
pkgconf_path=$PROJECT_DIR/.openblas |
| 32 |
echo pkgconf_path is $pkgconf_path, OPENBLAS is ${OPENBLAS} |
| 33 |
rm -rf $pkgconf_path |
| 34 |
mkdir -p $pkgconf_path |
| 35 |
python -m pip install -r $PROJECT_DIR/requirements/ci_requirements.txt |
| 36 |
python -c "import scipy_${OPENBLAS}; print(scipy_${OPENBLAS}.get_pkg_config())" > $pkgconf_path/scipy-openblas.pc |
| 37 |
|
| 38 |
# Copy scipy-openblas DLL's to a fixed location so we can point delvewheel |
| 39 |
# at it in `repair_windows.sh` (needed only on Windows because of the lack |
| 40 |
# of RPATH support). |
| 41 |
if [[ $RUNNER_OS == "Windows" ]]; then |
| 42 |
python <<EOF |
| 43 |
import os, scipy_${OPENBLAS}, shutil |
| 44 |
srcdir = os.path.join(os.path.dirname(scipy_${OPENBLAS}.__file__), "lib") |
| 45 |
shutil.copytree(srcdir, os.path.join("$pkgconf_path", "lib")) |
| 46 |
EOF |
| 47 |
fi |
| 48 |
fi |
| 49 |
|
| 50 |
if [[ $RUNNER_OS == "Windows" ]]; then |
| 51 |
# delvewheel is the equivalent of delocate/auditwheel for windows. |
| 52 |
python -m pip install delvewheel wheel |
| 53 |
fi |