-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcibw_before_build.sh
More file actions
64 lines (56 loc) · 2.51 KB
/
cibw_before_build.sh
File metadata and controls
64 lines (56 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
set -xe
PROJECT_DIR="${1:-$PWD}"
NUMPY_SRC_DIR="${1:-$PWD}/numpy-src"
# Update license
echo "" >> $NUMPY_SRC_DIR/LICENSE.txt
echo "----" >> $NUMPY_SRC_DIR/LICENSE.txt
echo "" >> $NUMPY_SRC_DIR/LICENSE.txt
if [[ $RUNNER_OS == "Linux" ]] ; then
cat $PROJECT_DIR/tools/wheels/LICENSE_linux.txt >> $NUMPY_SRC_DIR/LICENSE.txt
elif [[ $RUNNER_OS == "macOS" ]]; then
cat $PROJECT_DIR/tools/wheels/LICENSE_osx.txt >> $NUMPY_SRC_DIR/LICENSE.txt
elif [[ $RUNNER_OS == "Windows" ]]; then
cat $PROJECT_DIR/tools/wheels/LICENSE_win32.txt >> $NUMPY_SRC_DIR/LICENSE.txt
fi
if [[ $(python -c"import sys; print(sys.maxsize)") < $(python -c"import sys; print(2**33)") ]]; then
echo "No BLAS used for 32-bit wheels"
export INSTALL_OPENBLAS=false
elif [ -z $INSTALL_OPENBLAS ]; then
# the macos_arm64 build might not set this variable
export INSTALL_OPENBLAS=true
fi
# Install OpenBLAS from scipy-openblas32|64
if [[ "$INSTALL_OPENBLAS" = "true" ]] ; then
# By default, use scipy-openblas64
# On 32-bit platforms and on win-arm64, use scipy-openblas32
OPENBLAS=openblas64
# Possible values for RUNNER_ARCH in GitHub Actions are: X86, X64, ARM, or ARM64
if [[ $RUNNER_ARCH == "X86" || $RUNNER_ARCH == "ARM" ]] ; then
OPENBLAS=openblas32
elif [[ $RUNNER_ARCH == "ARM64" && $RUNNER_OS == "Windows" ]] ; then
OPENBLAS=openblas32
fi
# The PKG_CONFIG_PATH environment variable will be pointed to this path in
# cibuildwheel.toml and .github/workflows/wheels.yml. Note that
# `pkgconf_path` here is only a bash variable local to this file.
pkgconf_path=$PROJECT_DIR/.openblas
echo pkgconf_path is $pkgconf_path, OPENBLAS is ${OPENBLAS}
rm -rf $pkgconf_path
mkdir -p $pkgconf_path
python -m pip install -r $PROJECT_DIR/requirements/openblas_requirements.txt
python -c "import scipy_${OPENBLAS}; print(scipy_${OPENBLAS}.get_pkg_config())" > $pkgconf_path/scipy-openblas.pc
# Copy scipy-openblas DLL's to a fixed location so we can point delvewheel
# at it in `repair_windows.sh` (needed only on Windows because of the lack
# of RPATH support).
if [[ $RUNNER_OS == "Windows" ]]; then
python <<EOF
import os, scipy_${OPENBLAS}, shutil
srcdir = os.path.join(os.path.dirname(scipy_${OPENBLAS}.__file__), "lib")
shutil.copytree(srcdir, os.path.join("$pkgconf_path", "lib"))
EOF
fi
fi
# cibuildwheel doesn't install delvewheel by default
if [[ $RUNNER_OS == "Windows" ]]; then
python -m pip install -r $PROJECT_DIR/requirements/delvewheel_requirements.txt
fi