From 95cc9f6b968e20eeb4e5710fbc8ddffe0d6f1cf5 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 9 May 2023 05:26:40 +0000 Subject: [PATCH] import python3.11-scipy-1.10.0-1.el9 --- .gitignore | 1 + .python3.11-scipy.metadata | 1 + SOURCES/fix-32bit-test-failures.patch | 93 +++++++++ SPECS/python3.11-scipy.spec | 262 ++++++++++++++++++++++++++ 4 files changed, 357 insertions(+) create mode 100644 .gitignore create mode 100644 .python3.11-scipy.metadata create mode 100644 SOURCES/fix-32bit-test-failures.patch create mode 100644 SPECS/python3.11-scipy.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5fdeb12 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/scipy-1.10.0.tar.gz diff --git a/.python3.11-scipy.metadata b/.python3.11-scipy.metadata new file mode 100644 index 0000000..8337583 --- /dev/null +++ b/.python3.11-scipy.metadata @@ -0,0 +1 @@ +8094557cc6c2d2ec32faf2a9b33ed41b3a8acecc SOURCES/scipy-1.10.0.tar.gz diff --git a/SOURCES/fix-32bit-test-failures.patch b/SOURCES/fix-32bit-test-failures.patch new file mode 100644 index 0000000..2f112bc --- /dev/null +++ b/SOURCES/fix-32bit-test-failures.patch @@ -0,0 +1,93 @@ +diff --git a/scipy/sparse/linalg/_isolve/tests/test_iterative.py b/scipy/sparse/linalg/_isolve/tests/test_iterative.py +index a782a8d27c2..48fc16b7a00 100644 +--- a/scipy/sparse/linalg/_isolve/tests/test_iterative.py ++++ b/scipy/sparse/linalg/_isolve/tests/test_iterative.py +@@ -409,7 +409,9 @@ def test_atol(solver): + residual = A.dot(x) - b + err = np.linalg.norm(residual) + atol2 = tol * b_norm +- assert_(err <= max(atol, atol2)) ++ # Added 1.00025 fudge factor because of `err` exceeding `atol` just ++ # very slightly on s390x (see gh-17839) ++ assert_(err <= 1.00025 * max(atol, atol2)) + + + @pytest.mark.parametrize("solver", [cg, cgs, bicg, bicgstab, gmres, qmr, minres, lgmres, gcrotmk, tfqmr]) +@@ -452,8 +454,10 @@ def test_zero_rhs(solver): + and sys.version_info[1] == 9, + reason="gh-13019")), + qmr, +- pytest.param(lgmres, marks=pytest.mark.xfail(platform.machine() == 'ppc64le', +- reason="fails on ppc64le")), ++ pytest.param(lgmres, marks=pytest.mark.xfail( ++ platform.machine() not in ['x86_64' 'x86', 'aarch64', 'arm64'], ++ reason="fails on at least ppc64le, ppc64 and riscv64, see gh-17839") ++ ), + pytest.param(cgs, marks=pytest.mark.xfail), + pytest.param(bicg, marks=pytest.mark.xfail), + pytest.param(bicgstab, marks=pytest.mark.xfail), +diff --git a/scipy/special/tests/test_orthogonal.py b/scipy/special/tests/test_orthogonal.py +index a325cb1a9ef..408b03bde2e 100644 +--- a/scipy/special/tests/test_orthogonal.py ++++ b/scipy/special/tests/test_orthogonal.py +@@ -546,7 +546,7 @@ def test_roots_gegenbauer(): + vgq(rootf(170), evalf(170), weightf(170), -1., 1., 5, atol=1e-13) + vgq(rootf(170), evalf(170), weightf(170), -1., 1., 25, atol=1e-12) + vgq(rootf(170), evalf(170), weightf(170), -1., 1., 100, atol=1e-11) +- vgq(rootf(170.5), evalf(170.5), weightf(170.5), -1., 1., 5, atol=1e-13) ++ vgq(rootf(170.5), evalf(170.5), weightf(170.5), -1., 1., 5, atol=1.25e-13) + vgq(rootf(170.5), evalf(170.5), weightf(170.5), -1., 1., 25, atol=1e-12) + vgq(rootf(170.5), evalf(170.5), weightf(170.5), -1., 1., 100, atol=1e-11) + +diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py +index eceeafdffe0..139b0537174 100644 +--- a/scipy/stats/tests/test_distributions.py ++++ b/scipy/stats/tests/test_distributions.py +@@ -4254,7 +4254,7 @@ def test_pdf_nolan_samples( + ], + # for small alpha very slightly reduced accuracy + [ +- 'piecewise', 5e-11, lambda r: ( ++ 'piecewise', 2.5e-10, lambda r: ( + np.isin(r['pct'], pct_range) & + np.isin(r['alpha'], alpha_range) & + np.isin(r['beta'], beta_range) & +@@ -4358,7 +4358,7 @@ def test_cdf_nolan_samples( + tests = [ + # piecewise generally good accuracy + [ +- 'piecewise', 1e-12, lambda r: ( ++ 'piecewise', 2e-12, lambda r: ( + np.isin(r['pct'], pct_range) & + np.isin(r['alpha'], alpha_range) & + np.isin(r['beta'], beta_range) & +@@ -4480,6 +4480,14 @@ def test_location_scale( + ): + """Tests for pdf and cdf where loc, scale are different from 0, 1 + """ ++ ++ uname = platform.uname() ++ is_linux_32 = uname.system == 'Linux' and "32bit" in platform.architecture()[0] ++ # Test seems to be unstable (see gh-17839 for a bug report on Debian ++ # i386), so skip it. ++ if is_linux_32 and case == 'pdf': ++ pytest.skip("Test unstable on some platforms; see gh-17839, 17859") ++ + data = nolan_loc_scale_sample_data + # We only test against piecewise as location/scale transforms + # are same for other methods. +diff --git a/scipy/stats/tests/test_mstats_basic.py b/scipy/stats/tests/test_mstats_basic.py +index cd53c7b7914..76cbfd8c253 100644 +--- a/scipy/stats/tests/test_mstats_basic.py ++++ b/scipy/stats/tests/test_mstats_basic.py +@@ -1768,8 +1768,8 @@ def test_skewtest_2D_WithMask(self): + r = stats.skewtest(x) + rm = stats.mstats.skewtest(xm) + +- assert_allclose(r[0][0], rm[0][0], rtol=2e-15) +- assert_allclose(r[0][1], rm[0][1], rtol=1e-15) ++ assert_allclose(r[0][0], rm[0][0], rtol=1e-14) ++ assert_allclose(r[0][1], rm[0][1], rtol=1e-14) + + def test_normaltest(self): + with np.errstate(over='raise'), suppress_warnings() as sup: diff --git a/SPECS/python3.11-scipy.spec b/SPECS/python3.11-scipy.spec new file mode 100644 index 0000000..f0811fa --- /dev/null +++ b/SPECS/python3.11-scipy.spec @@ -0,0 +1,262 @@ +%global __python3 /usr/bin/python3.11 +%global python3_pkgversion 3.11 + +# 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. +%bcond_with pythran + +# Set to pre-release version suffix if building pre-release, else %%{nil} +%global rcver %{nil} + +%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9 +%global blaslib flexiblas +%global blasvar %{nil} +%else +%global blaslib openblas +%global blasvar p +%endif + +%global modname scipy + +Summary: Scientific Tools for Python +Name: python%{python3_pkgversion}-scipy +Version: 1.10.0 +Release: 1%{?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 +Url: http://www.scipy.org/scipylib/index.html +Source0: https://github.com/scipy/scipy/releases/download/v%{version}/scipy-%{version}.tar.gz + +# Fix some test failures on 32 bits +# https://github.com/scipy/scipy/pull/17859 +# https://github.com/scipy/scipy/pull/17931 +Patch0: fix-32bit-test-failures.patch + +BuildRequires: fftw-devel, suitesparse-devel +BuildRequires: %{blaslib}-devel +BuildRequires: gcc-gfortran, swig, gcc-c++ +BuildRequires: qhull-devel + +BuildRequires: python%{python3_pkgversion}-pybind11-devel +BuildRequires: python%{python3_pkgversion}-pybind11 >= 2.4.0 +BuildRequires: python%{python3_pkgversion}-numpy, python%{python3_pkgversion}-devel, python%{python3_pkgversion}-numpy-f2py +BuildRequires: python%{python3_pkgversion}-rpm-macros +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-Cython +BuildRequires: python%{python3_pkgversion}-pytest + +%if %{with pythran} +BuildRequires: pythran +%endif + +Requires: python%{python3_pkgversion}-numpy, python%{python3_pkgversion}-f2py + +%global _description %{expand: +Scipy is open-source software for mathematics, science, and +engineering. The core library is NumPy which provides convenient and +fast N-dimensional array manipulation. The SciPy library is built to +work with NumPy arrays, and provides many user-friendly and efficient +numerical routines such as routines for numerical integration and +optimization. Together, they run on all popular operating systems, are +quick to install, and are free of charge. NumPy and SciPy are easy to +use, but powerful enough to be depended upon by some of the world's +leading scientists and engineers.} + +%description %_description + +%prep +%autosetup -p1 -n %{modname}-%{version}%{?rcver} +cat > site.cfg << 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} +EOF + +rm $(grep -rl '/\* Generated by Cython') PKG-INFO + +%build +export SCIPY_USE_PYTHRAN=0%{?with_pythran} + +for PY in %{python3_pkgversion}; do + # Adding -fallow-argument-mismatch workaround for https://github.com/scipy/scipy/issues/11611 + env CFLAGS="$RPM_OPT_FLAGS -lm" \ + FFLAGS="$RPM_OPT_FLAGS -fPIC -cpp" \ + LDFLAGS="$RPM_LD_FLAGS -shared" \ + %if 0%{?rhel} >= 9 + %ifarch x86_64 + # workaround for https://bugzilla.redhat.com/show_bug.cgi?id=2068530 + LDFLAGS="%{__global_ldflags} -Wl,--no-as-needed -lmvec -Wl,--as-needed" \ + %endif + %endif + %{_bindir}/python$PY setup.py config_fc \ + --fcompiler=gnu95 --noarch \ + build + +done + +%install +export SCIPY_USE_PYTHRAN=0%{?with_pythran} + +%py3_install +# Some files got ambiguous python shebangs, we fix them after everything else is done +%py3_shebang_fix %{buildroot}%{python3_sitearch} + +%check +# check against the reference BLAS/LAPACK +export FLEXIBLAS=netlib + + +# https://github.com/scipy/scipy/issues/17912 +SKIP_ALL_ARCHS="\ +not TestDatasets and \ +not TestOde and \ +not TestComplexOde and \ +not TestVODECheckParameterUse and \ +not TestZVODECheckParameterUse and \ +not test_banded_ode_solvers and \ +not test_examples[True-complex64]" + +# skip also failing test_sygst for now +SKIP_X86_64="-k '$SKIP_ALL_ARCHS and \ +not test_sygst'" + +# https://bugzilla.redhat.com/show_bug.cgi?id=1959353 +# TestConstructUtils::test_concatenate_int32_overflow is flaky on aarch64 +SKIP_AARCH64="-k '$SKIP_ALL_ARCHS and \ +not test_solve_discrete_are and \ +not test_maxiter_worsening[lgmres] and \ +not test_concatenate_int32_overflow'" + +# Those tests fail on koji/brew for ppc64le but pass +# locally for that architecture +SKIP_PPC64LE="-k '$SKIP_ALL_ARCHS'" + +# https://bugzilla.redhat.com/show_bug.cgi?id=1959353 +SKIP_S390X="-k '$SKIP_ALL_ARCHS and \ +not test_solve_discrete_are and \ +not test_maxiter_worsening[lgmres] and \ +not TestInterop and \ +not TestSplder and \ +not test_dblint and \ +not TestUnivariateSpline and \ +not TestLSQBivariateSpline and \ +not TestPPoly and \ +not TestLevyStable'" + +# skip also test_cython_api: https://bugzilla.redhat.com/show_bug.cgi?id=2068496 +# https://github.com/scipy/scipy/issues/17213 +SKIP_32BIT="-k '$SKIP_ALL_ARCHS and \ +not test_sygst and \ +not test_cython_api and \ +not test_examples and \ +not test_shifts and \ +not test_mu and \ +not test_sum and \ +not test_svdp and \ +not test_resiliency_all_32 and \ +not test_resiliency_random[TestCSC-test_sum_dtype] and \ +not test_x0_equals_Mb[bicgstab] and \ +not test_gh12218'" + +export PYTEST_ADDOPTS="-k '$SKIP_ALL_ARCHS'" +# default test timeout +TIMEOUT=500 + +%ifarch x86_64 +export PYTEST_ADDOPTS=$SKIP_X86_64 +%endif + +%ifarch aarch64 +export PYTEST_ADDOPTS=$SKIP_AARCH64 +TIMEOUT=1000 +%endif + +%ifarch ppc64le +export PYTEST_ADDOPTS=$SKIP_PPC64LE +TIMEOUT=1000 +%endif + +%ifarch s390x +export PYTEST_ADDOPTS=$SKIP_S390X +TIMEOUT=1000 +%endif + +%ifarch armv7hl +export PYTEST_ADDOPTS=$SKIP_32BIT +%endif + +%ifarch i686 +export PYTEST_ADDOPTS=$SKIP_32BIT +%endif + +pushd %{buildroot}/%{python3_sitearch} +# Ignoring the datasets tests as we don't have the optional pooch +# dependency on RHEL. +%{pytest} --ignore=scipy/datasets/tests/test_data.py scipy +# Remove test remnants +rm -rf gram{A,B} +popd + +%files -n python%{python3_pkgversion}-scipy +%doc LICENSE.txt +%{python3_sitearch}/scipy/ +%{python3_sitearch}/*.egg-info + +%changelog +* Sun Feb 19 2023 Charalampos Stratakis - 1.10.0-1 +- Update to 1.10.0 + +* Thu Dec 01 2022 Charalampos Stratakis - 1.8.1-1 +- Initial package +- Fedora contributions by: + Antonio Trande + Bill Nottingham + Björn Esser + Charalampos Stratakis + Christian Dersch + David Malcolm + Deji Akingunola + Dennis Gilmore + Elliott Sales de Andrade + Ignacio Vazquez-Abrams + Igor Gnatenko + Iñaki Úcar + Jef Spaleta + Jesse Keating + Jitka Plesnikova + Jonathan Wakely + Jon Ciesla + Kalev Lember + Kevin Fenzi + Lumir Balhar + Mamoru TASAKA + Marcel Plch + Miro Hrončok + Nikola Forró + Nils Philippsen + Orion Poplawski + Pavel Šimovec + Peter Robinson + Petr Viktorin + Robert Kuska + Than Ngo + Thomas Spura + Tomas Tomecek + Toshio Kuratomi + Troy Dawson + Zbigniew Jędrzejewski-Szmek