Repository navigation
Expand file tree
/
Copy pathcibw_before_build.sh
More file actions
49 lines (40 loc) · 1.96 KB
/
Copy pathcibw_before_build.sh
File metadata and controls
49 lines (40 loc) · 1.96 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
set -xe
PROJECT_DIR="${1:-$PWD}"
SCIPY_SRC_DIR="${1:-$PWD}/scipy-src"
# Update license
echo "" >> $SCIPY_SRC_DIR/LICENSE.txt
echo "----" >> $SCIPY_SRC_DIR/LICENSE.txt
echo "" >> $SCIPY_SRC_DIR/LICENSE.txt
if [[ $RUNNER_OS == "Linux" ]] ; then
cat $PROJECT_DIR/tools/wheels/LICENSE_linux.txt >> $SCIPY_SRC_DIR/LICENSE.txt
elif [[ $RUNNER_OS == "macOS" ]]; then
cat $PROJECT_DIR/tools/wheels/LICENSE_osx.txt >> $SCIPY_SRC_DIR/LICENSE.txt
elif [[ $RUNNER_OS == "Windows" ]]; then
cat $PROJECT_DIR/tools/wheels/LICENSE_win32.txt >> $SCIPY_SRC_DIR/LICENSE.txt
fi
# Every wheel links against scipy-openblas32, except the macOS ones built against
# Accelerate - wheels.yml sets INSTALL_OPENBLAS=false for those, and leaves it unset
# everywhere else. scipy-openblas64 is not used for wheels at all.
INSTALL_OPENBLAS=${INSTALL_OPENBLAS:-true}
OPENBLAS_GRP=""
if [[ "$INSTALL_OPENBLAS" = "true" ]] ; then
OPENBLAS_GRP="--group openblas32"
fi
# install build dependencies via uv
# log which uv this is: on Linux it comes from the manylinux image, not from setup-uv
uv --version
# the lock file lives in this repo, not in the scipy checkout; the check_lock job in
# wheels.yml verifies it still matches scipy's dependency groups
PYTHON_EXE="$(python -c 'import sys; print(sys.executable)')"
uv export --project "$PROJECT_DIR" --no-default-groups --group build --no-emit-project $OPENBLAS_GRP --frozen | \
uv pip install --python "$PYTHON_EXE" --no-deps --require-hashes -r -
# Configure the pkg-config file for OpenBLAS
if [[ "$INSTALL_OPENBLAS" = "true" ]] ; then
# 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
rm -rf $pkgconf_path
mkdir -p $pkgconf_path
python -c "import scipy_openblas32; print(scipy_openblas32.get_pkg_config())" > $pkgconf_path/scipy-openblas.pc
fi