python3-scipy: update to 1.11.0, build with meson

This commit is contained in:
Andrew J. Hesford 2023-02-24 09:41:50 -05:00
parent 2cf0451a1b
commit e397870c0e
2 changed files with 57 additions and 29 deletions

View File

@ -0,0 +1,14 @@
There doesn't seem to be a valid reason for this restriction, and it doesn't
impede building anyway.
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -40,7 +40,7 @@
# however macOS was broken and it's safe C API/ABI-wise to build against 1.21.6
# (see oldest-supported-numpy issues gh-28 and gh-45)
"numpy==1.21.6; python_version=='3.10' and (platform_system!='Windows' and platform_machine!='loongarch64') and platform_python_implementation != 'PyPy'",
- "numpy==1.23.2; python_version=='3.11' and platform_python_implementation != 'PyPy'",
+ "numpy>=1.23.2; python_version=='3.11' and platform_python_implementation != 'PyPy'",
# For Python versions which aren't yet officially supported,
# we specify an unpinned NumPy which allows source distributions

View File

@ -1,26 +1,35 @@
# Template file for 'python3-scipy'
pkgname=python3-scipy
version=1.10.1
version=1.11.0
revision=1
build_style=python3-module
build_helper="numpy"
make_check_args="--force"
hostmakedepends="gcc-fortran python3-setuptools
pythran python3-Cython python3-pybind11"
makedepends="python3-devel python3-pybind11
build_style=meson
build_helper="python3"
hostmakedepends="python3-build python3-installer python3-meson-python
python3-wheel python3-Cython python3-pybind11 pythran python3-numpy
gcc-fortran pkg-config"
makedepends="python3-devel python3-pybind11 python3-numpy pythran
$(vopt_if openblas openblas-devel lapack-devel)"
depends="python3-numpy"
checkdepends="python3-pytest-xdist python3-pooch"
short_desc="Scientific library for Python3"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="BSD-3-Clause"
homepage="https://scipy.org/scipylib/"
distfiles="https://github.com/scipy/scipy/releases/download/v${version}/scipy-${version}.tar.gz"
checksum=2cf9dfb80a7b4589ba4c40ce7588986d6d5cebc5457cad2c2880f6bc2d42f3a5
make_check="ci-skip" # Tests require downloaded data and take a long time
distfiles="${PYPI_SITE}/s/scipy/scipy-${version}.tar.gz"
checksum=f9b0248cb9d08eead44cde47cbf6339f1e9aa0dfde28f5fb27950743e317bd5d
make_check="no" # Tests need an installed copy to run and meson makes this tough
build_options="openblas"
if [ "$CROSS_BUILD" ]; then
_pybind11_dir="${py3_sitelib}/pybind11"
configure_args="--cross-file=python.cross"
export PKG_CONFIG_PATH="${XBPS_CROSS_BASE}/${_pybind11_dir}/share/pkgconfig"
# pybind11 uses a path relative to the pkgconfig file to set $prefix,
# which causes the wrapper to double-include $XBPS_CROSS_BASE; override
# so that the wrapper properly points to the right location
export PKG_CONFIG_PYBIND11_PREFIX="/${_pybind11_dir}"
fi
case "$XBPS_TARGET_MACHINE" in
x86_64*|i686*|aarch64*|armv[67]*|ppc64*)
# Prefer accelerated routines where available
@ -36,29 +45,34 @@ if [ "$build_option_openblas" ]; then
esac
fi
# Tell numpy to build in parallel
export NPY_NUM_BUILD_JOBS="${XBPS_MAKEJOBS}"
pre_patch() {
if [ "${CROSS_BUILD}" ]; then
# Meson can't tolerate $CC with arguments as set by the build helper
CC="${XBPS_CROSS_TRIPLET}-gcc"
# CXX needs to know where to find Python headers
CXXFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_inc}"
fi
}
pre_build() {
# Find the right linear algebra subroutines on the target arch
: > site.cfg
for _blaslib in $(vopt_if openblas openblas "lapack blas"); do
cat >> site.cfg <<-EOF
[$_blaslib]
libraries = ${_blaslib}
include_dirs = ${XBPS_CROSS_BASE}/usr/include
library_dirs = ${XBPS_CROSS_BASE}/usr/lib
runtime_library_dirs = ${XBPS_CROSS_BASE}/usr/lib
post_patch() {
if [ "$CROSS_BUILD" ]; then
local _xpy="${XBPS_CROSS_BASE}/${py3_sitelib}"
cat > python.cross <<-EOF
[properties]
numpy-include-dir = '${_xpy}/numpy/core/include'
pythran-include-dir = '${_xpy}/pythran'
EOF
done
fi
}
do_check() {
touch .coveragerc
python3 ./runtests.py --verbose ${makejobs}
do_build() {
# Use the build directory already configured by xbps-src for meson
python3 -m build --no-isolation --wheel \
-Cbuilddir="./build" -Ccompile-args="${makejobs}" .
}
post_install() {
rm ${DESTDIR}/${py3_sitelib}/scipy/*.txt
do_install() {
python3 -m installer --destdir "${DESTDIR}" \
--no-compile-bytecode dist/*.whl
vlicense LICENSE.txt
}