This repository has been archived by the owner on Feb 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
config.sh
77 lines (70 loc) · 2.31 KB
/
config.sh
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
65
66
67
68
69
70
71
72
73
74
75
76
77
# Define custom utilities
# Test for OSX with [ -n "$IS_OSX" ]
# See env_vars.sh for extra environment variables
source gfortran-install/gfortran_utils.sh
function build_wheel {
export FFLAGS="$FFLAGS -fPIC"
if [ -z "$IS_OSX" ]; then
build_libs $PLAT
# Work round build dependencies spec in pyproject.toml
build_bdist_wheel $@
else
install_gfortran
wrap_wheel_builder build_osx_wheel $@
fi
}
function build_libs {
PYTHON_EXE=`which python`
$PYTHON_EXE -c"import platform; print('platform.uname().machine', platform.uname().machine)"
basedir=$($PYTHON_EXE scipy/tools/openblas_support.py)
$use_sudo cp -r $basedir/lib/* $BUILD_PREFIX/lib
$use_sudo cp $basedir/include/* $BUILD_PREFIX/include
export OPENBLAS=$BUILD_PREFIX
}
function build_wheel_with_patch {
# Patch numpy distutils to fix OpenBLAS build
(cd .. && ./patch_numpy.sh)
bdist_wheel_cmd $@
}
function build_osx_wheel {
local repo_dir=${1:-$REPO_DIR}
if [ ! -z "$FC" ]; then
export F77=$FC
export F90=$FC
fi
build_libs
# Work round build dependencies spec in pyproject.toml
# See e.g.
# https://travis-ci.org/matthew-brett/scipy-wheels/jobs/387794282
build_wheel_cmd "build_wheel_with_patch" "$repo_dir"
}
function run_tests {
# Runs tests on installed distribution from an empty directory
# OSX tests seem to time out pretty often
if [[ -z "$IS_OSX" && `uname -m` != 'aarch64' ]]; then
local testmode="full"
else
local testmode="fast"
fi
# Check bundled license file
$PYTHON_EXE ../check_installed_package.py
# Run tests
if [[ -z "$IS_OSX" && `uname -m` != 'aarch64' ]]; then
$PYTHON_EXE ../run_scipy_tests.py $testmode -- -n2 -rfEX
else
$PYTHON_EXE ../run_scipy_tests.py $testmode -- -n8 -rfEX
fi
# Show BLAS / LAPACK used
$PYTHON_EXE -c 'import scipy; scipy.show_config()'
}
function install_run {
# Override multibuild test running command, to preinstall packages
# that have to be installed before TEST_DEPENDS.
set -ex
PIP_CMD="$PYTHON_EXE -m pip"
$PYTHON_EXE -m pip install $(pip_opts) setuptools_scm
# Copypaste from multibuild/common_utils.sh:install_run
install_wheel --prefer-binary
mkdir tmp_for_test
(cd tmp_for_test && run_tests)
}