Merge remote-tracking branch 'up/main' into main-riscv64

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2023-11-29 21:00:44 +02:00
commit 35a25c615d
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
5 changed files with 167 additions and 134 deletions

1
.gitignore vendored
View File

@ -42,3 +42,4 @@ scipy-0.7.2.tar.gz
/scipy-1.10.0.tar.gz
/scipy-1.10.1.tar.gz
/scipy-1.11.1.tar.gz
/scipy-1.11.3.tar.gz

28
19443.patch Normal file
View File

@ -0,0 +1,28 @@
From 28413806316049c09bb4b0182f652cce0ba82a50 Mon Sep 17 00:00:00 2001
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
Date: Fri, 27 Oct 2023 16:47:37 -0400
Subject: [PATCH] TST: Fix #19442 minimally
Use a sorted version of the set REAL_DTYPES to parameterize
test_b_orthonormalize.
---
scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py b/scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py
index c17d37051fca..fd6f166dc62d 100644
--- a/scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py
+++ b/scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py
@@ -101,9 +101,9 @@ def test_MikotaPair():
@pytest.mark.parametrize("n", [50])
@pytest.mark.parametrize("m", [1, 2, 10])
-@pytest.mark.parametrize("Vdtype", REAL_DTYPES)
-@pytest.mark.parametrize("Bdtype", REAL_DTYPES)
-@pytest.mark.parametrize("BVdtype", REAL_DTYPES)
+@pytest.mark.parametrize("Vdtype", sorted(REAL_DTYPES, key=str))
+@pytest.mark.parametrize("Bdtype", sorted(REAL_DTYPES, key=str))
+@pytest.mark.parametrize("BVdtype", sorted(REAL_DTYPES, key=str))
def test_b_orthonormalize(n, m, Vdtype, Bdtype, BVdtype):
"""Test B-orthonormalization by Cholesky with callable 'B'.
The function '_b_orthonormalize' is key in LOBPCG but may

View File

@ -1,63 +0,0 @@
From 3c89445b6439f3ce7bffc4cf11c6407c39faedc5 Mon Sep 17 00:00:00 2001
From: Matus Valo <matusvalo@users.noreply.github.com>
Date: Thu, 6 Jul 2023 16:55:25 +0200
Subject: [PATCH] BLD: copy `cython_optimize.pxd` to build dir (#18810)
Closes gh-18792
[skip cirrus] [skip circle]
---------
Co-authored-by: Ralf Gommers <ralf.gommers@gmail.com>
---
scipy/optimize/cython_optimize.pxd | 2 +-
scipy/optimize/cython_optimize/meson.build | 1 +
scipy/optimize/meson.build | 8 +++++++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/scipy/optimize/cython_optimize.pxd b/scipy/optimize/cython_optimize.pxd
index d5a0bdd758e0..d35f8da68b34 100644
--- a/scipy/optimize/cython_optimize.pxd
+++ b/scipy/optimize/cython_optimize.pxd
@@ -7,5 +7,5 @@
# support. Changing it causes an ABI forward-compatibility break
# (gh-11793), so we currently leave it as is (no further cimport
# statements should be used in this file).
-from .cython_optimize._zeros cimport (
+from scipy.optimize.cython_optimize._zeros cimport (
brentq, brenth, ridder, bisect, zeros_full_output)
diff --git a/scipy/optimize/cython_optimize/meson.build b/scipy/optimize/cython_optimize/meson.build
index 359ea8418ba3..ee8def39b4d3 100644
--- a/scipy/optimize/cython_optimize/meson.build
+++ b/scipy/optimize/cython_optimize/meson.build
@@ -17,6 +17,7 @@ cy_opt_gen = generator(cython,
arguments : cython_args,
output : '@BASENAME@.c',
depends : [_cython_tree,
+ cython_optimize_pxd,
_dummy_init_optimize,
_dummy_init_cyoptimize])
diff --git a/scipy/optimize/meson.build b/scipy/optimize/meson.build
index 26458b05cd70..4c5ab798316b 100644
--- a/scipy/optimize/meson.build
+++ b/scipy/optimize/meson.build
@@ -206,10 +206,16 @@ endif
_dummy_init_optimize = fs.copyfile('__init__.py')
+# Copying this .pxd file is only needed because of a Cython bug, see
+# discussion on SciPy PR gh-18810.
+cython_optimize_pxd = [
+ fs.copyfile('cython_optimize.pxd'),
+]
+
opt_gen = generator(cython,
arguments : cython_args,
output : '@BASENAME@.c',
- depends : [_cython_tree, cython_blas_pxd, _dummy_init_optimize])
+ depends : [_cython_tree, cython_blas_pxd, cython_optimize_pxd, _dummy_init_optimize])
_bglu_dense_c = opt_gen.process('_bglu_dense.pyx')

View File

@ -4,12 +4,10 @@
# Pythran is an optional build dependency.
# When used, it makes some modules faster,
# but it is usually not available soon enough for new major Python versions.
%ifarch i686 armv7hl riscv64
# It seems pythran is broken on 32-bit arches, disable it
%bcond_with pythran
%else
%bcond_without pythran
%endif
# The code is not safe to build with LTO
%global _lto_cflags %{nil}
# Set to pre-release version suffix if building pre-release, else %%{nil}
%global rcver %{nil}
@ -24,39 +22,54 @@
Summary: Scientific Tools for Python
Name: scipy
Version: 1.11.1
Release: 1.0.riscv64%{?dist}
Version: 1.11.3
Release: 2.0.riscv64%{?dist}
# BSD -- whole package except:
# Boost -- scipy/special/cephes/scipy_iv.c
# Public Domain -- scipy/odr/__odrpack.c
License: BSD and Boost and Public Domain
# BSD-3-Clause -- whole package except:
# BSD-2-Clause -- scipy/_lib/_pep440.py
# scipy/_lib/decorator.py
# scipy/optimize/lbfgsb_src
# scipy/special/_ellip_harm.pxd
# MIT -- scipy/cluster/_optimal_leaf_ordering.pyx
# scipy/io/_idl.py
# scipy/linalg/_basic.py (in part)
# scipy/optimize/_highs
# scipy/optimize/_lbfgsb_py.py
# scipy/optimize/_tnc.py
# scipy/optimize/_trlib
# scipy/optimize/tnc
# scipy/special/Faddeeva.{cc,hh}
# BSL-1.0 -- scipy/_lib/boost_math
# scipy/special/cephes
# Boehm-GC -- scipy/sparse/linalg/_dsolve/SuperLU
# Qhull -- scipy/spatial/qhull_src
# LicenseRef-Fedora-Public-Domain -- scipy/odr/__odrpack.c
License: BSD-3-Clause AND BSD-2-Clause AND MIT AND BSL-1.0 AND Boehm-GC AND Qhull AND LicenseRef-Fedora-Public-Domain
Url: http://www.scipy.org/scipylib/index.html
Source0: https://github.com/scipy/scipy/releases/download/v%{version}/scipy-%{version}.tar.gz
# Fix build failure with Cython 3 when scipy is already installed
Patch: https://github.com/scipy/scipy/commit/3c89445b6439f3ce7bffc4cf11c6407c39faedc5.patch
# TST: Fix #19442 minimally
# https://github.com/scipy/scipy/pull/19443
#
# Fixes:
#
# BUG: Error collecting tests due to inconsistent parameterization order in
# test_b_orthonormalize
# https://github.com/scipy/scipy/issues/19442
Patch: https://github.com/scipy/scipy/pull/19443.patch
BuildRequires: fftw-devel, suitesparse-devel
BuildRequires: %{blaslib}-devel
BuildRequires: gcc-gfortran, swig, gcc-c++
BuildRequires: qhull-devel
BuildRequires: gcc-gfortran, gcc-c++
BuildRequires: pybind11-devel
BuildRequires: python3-pybind11 >= 2.4.0
BuildRequires: python3-numpy, python3-devel, python3-numpy-f2py
BuildRequires: python3-pooch
BuildRequires: python3-setuptools
BuildRequires: python3-Cython
BuildRequires: python3-devel, python3-numpy-f2py
BuildRequires: python3-pytest
BuildRequires: python3-pytest-timeout
%if ! 0%{?rhel}
BuildRequires: python3-pytest-xdist
%endif
BuildRequires: python3-pytest-timeout
%if %{with pythran}
BuildRequires: pythran
%endif
BuildRequires: python3-pooch
%if %{with doc}
BuildRequires: python3-sphinx
@ -80,7 +93,20 @@ leading scientists and engineers.}
%package -n python3-scipy
Summary: Scientific Tools for Python
Requires: python3-numpy, python3-f2py, python3-pooch
%{?python_provide:%python_provide python3-scipy}
Provides: bundled(arpack) = 3.3.0
Provides: bundled(biasedurn)
Provides: bundled(boost-math)
Provides: bundled(coin-or-HiGHS) = 1.2
Provides: bundled(Faddeeva)
Provides: bundled(id)
Provides: bundled(l-bfgs-b) = 3.0
Provides: bundled(LAPJVsp)
Provides: bundled(python3-decorator) = 4.0.5
Provides: bundled(python3-pep440)
Provides: bundled(python3-pypocketfft) = bf2c431c21213b7c5e23c2f542009b0bd3ec1445
Provides: bundled(qhull) = 2019.1
Provides: bundled(SuperLU) = 5.2.0
Provides: bundled(unuran) = 1.8.1
%description -n python3-scipy %_description
%if %{with doc}
@ -100,61 +126,88 @@ Scipy test files
%prep
%autosetup -p1 -n %{name}-%{version}%{?rcver}
cat > site.cfg << EOF
cat >> pyproject.toml << EOF
[amd]
library_dirs = %{_libdir}
include_dirs = /usr/include/suitesparse
amd_libs = amd
[umfpack]
library_dirs = %{_libdir}
include_dirs = /usr/include/suitesparse
umfpack_libs = umfpack
[openblas]
libraries = %{blaslib}%{blasvar}
library_dirs = %{_libdir}
[tool.meson-python.args]
setup = ['-Dblas=%{blaslib}%{blasvar}', '-Dlapack=%{blaslib}%{blasvar}'%{!?with_pythran:, '-Duse-pythran=false'}]
EOF
# Enable build with Python 3.13+
# Upstream only allows Python pre-releases in git HEAD, not in releases.
# However in Fedora, we actively build packages with Python pre-releases very soon.
sed -i 's/requires-python = ">=3.9,<3.13"/requires-python = ">=3.9"/' pyproject.toml
# Docs won't build unless the .dat files are specified here
sed -i 's/metadata = dict(/metadata = dict(package_data={"": ["*.dat"]},/' setup.py
sed -i 's/metadata = dict(/metadata = dict(package_data={"": ["*.dat"]},/' _setup.py
rm $(grep -rl '/\* Generated by Cython') PKG-INFO
# numpy no longer contains a copy of distutils
for f in $(grep -Frl numpy.distutils); do
sed -i.orig 's/numpy\.\(distutils\)/\1/g' $f
touch -r $f.orig $f
rm $f.orig
done
# Do not do benchmarking or coverage testing for RPM builds
sed -i '/^[[:blank:]]*"(asv|pytest-cov)"/d' pyproject.toml
# No scikit-umfpack in Fedora
sed -i '/^[[:blank:]]*"scikit-umfpack"/d' pyproject.toml
# No pytest-xdist in RHEL
%if 0%{?rhel}
sed -i '/^[[:blank:]]*"pytest-xdist"/d' pyproject.toml
%endif
# Remove pythran dependency if not explicitly required
%if %{without pythran}
sed -i '/pythran/d' pyproject.toml
%endif
# Loosen the lower bound on numpy
sed -i "/numpy.*python_version=='3.12'/s/1\.26\.0/1\.24\.4/" pyproject.toml
# Loosen the upper bound on meson-python
sed -i '/meson-python/s/0\.15\.0/0\.16\.0/' pyproject.toml
# Loosen the upper bound on Cython
sed -i '/Cython/s/3\.0/3\.1/' pyproject.toml
# Loosen the upper bound on pybind11
sed -i '/pybind11/s/2\.11\.1/2.12.0/' pyproject.toml
# Work around failure to detect open_memstream. In glibc, open_memstream is
# not a real function. It is a weak alias to __open_memstream.
sed -i "s/\('has_openmemstream', \)'0'/\1'1'/" scipy/_lib/meson.build
%generate_buildrequires
%pyproject_buildrequires -R
%build
export SCIPY_USE_PYTHRAN=0%{?with_pythran}
%pyproject_wheel
%if %{with doc}
for PY in %{python3_version}; do
# Adding -fallow-argument-mismatch workaround for https://github.com/scipy/scipy/issues/11611
env CFLAGS="$RPM_OPT_FLAGS -lm" \
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
FFLAGS="$RPM_OPT_FLAGS -fPIC -fallow-argument-mismatch" \
%else
FFLAGS="$RPM_OPT_FLAGS -fPIC" \
%endif
LDFLAGS="%{__global_ldflags}" \
%{_bindir}/python$PY setup.py config_fc \
--fcompiler=gnu95 --noarch \
build
%if %{with doc}
pushd doc
export PYTHONPATH=$(echo ../build/lib.linux-*-$PY/)
make html SPHINXBUILD=sphinx-build-$PY
rm -rf build/html/.buildinfo
mv build build-$PY
popd
%endif
done
%endif
%install
export SCIPY_USE_PYTHRAN=0%{?with_pythran}
%pyproject_install
%pyproject_save_files scipy
%py3_install
# Some files got ambiguous python shebangs, we fix them after everything else is done
%py3_shebang_fix %{buildroot}%{python3_sitearch}
# Fix executable bits
chmod 0755 %{buildroot}%{python3_sitearch}/scipy/sparse/linalg/_isolve/tests/test_gcrotmk.py
%check
# check against the reference BLAS/LAPACK
export FLEXIBLAS=netlib
@ -200,19 +253,20 @@ TIMEOUT=1000
%endif
%ifarch x86_64
# skip also failing test_sygst for now
%if 0%{?rhel}
export PYTEST_ADDOPTS="-k '$SKIP_ALL and \
%{?rhel:not TestPPoly and \
not TestPPoly and \
not TestLinprogIPSparse and \
not test_axis_nan_policy_full and} \
not test_sygst'"
not test_axis_nan_policy_full'"
%else
export PYTEST_ADDOPTS="-k '$SKIP_ALL'"
%endif
%endif
%ifarch i686 armv7hl
# skip also test_cython_api: https://bugzilla.redhat.com/show_bug.cgi?id=2068496
# https://github.com/scipy/scipy/issues/17213
export PYTEST_ADDOPTS="-k '$SKIP_ALL and \
not test_sygst and \
not test_cython_api and \
not test_examples and \
not test_shifts and \
@ -239,13 +293,11 @@ pushd %{buildroot}/%{python3_sitearch}
%{pytest} --timeout=${TIMEOUT} scipy %{?!rhel:--numprocesses=auto}
# Remove test remnants
rm -rf gram{A,B}
rm -rf scipy/.pytest_cache
rm -rf .pytest_cache
popd
%files -n python3-scipy
%doc LICENSE.txt
%{python3_sitearch}/scipy/
%{python3_sitearch}/*.egg-info
%files -n python3-scipy -f %{pyproject_files}
%license LICENSE.txt
%exclude %{python3_sitearch}/scipy/*/tests/
%exclude %{python3_sitearch}/scipy/*/*/tests/
%exclude %{python3_sitearch}/scipy/*/*/*/tests/
@ -264,9 +316,24 @@ popd
%endif
%changelog
* Mon Nov 06 2023 David Abdurachmanov <davidlt@rivosinc.com> - 1.11.1-1.0.riscv64
* Wed Nov 29 2023 David Abdurachmanov <davidlt@rivosinc.com> - 1.11.3-2.0.riscv64
- Enable riscv64
* Wed Nov 01 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.11.3-2
- Patch error collecting tests with pytest-xdist
* Wed Oct 11 2023 Jerry James <loganjerry@gmail.com> - 1.11.3-1
- New upstream release 1.11.3
resolves: #2211813
- Convert License tag to SPDX
- Add Provides for bundled projects
- Disable LTO
- Pythran works on 32-bit architectures again
- Fix detection of open_memstream
- Use pyproject macros instead of the deprecated py3 macros
- Reenable some tests that work again
- Remove unused BuildRequires
* Wed Jul 12 2023 psimovec <psimovec@redhat.com> - 1.11.1-1
- New upstream release 1.11.1
resolves: #2211813

View File

@ -1 +1 @@
SHA512 (scipy-1.11.1.tar.gz) = 049c9061ccbf101e6f93e055f905616bc7775fbc51c3af99d8533aedc828c5e55d525ccd98b7299280ed706f3298975f28127de9b66809dfe198b0cc4fef466b
SHA512 (scipy-1.11.3.tar.gz) = 6491c4e479d9f4f02e677396a25ddca947a0dc6c009fc2ec34c658012a6224c0b535f14045bb011fbde9973ea987d184574ed64e6760c31798ec860eb0896fcf