%global python3_pkgversion 3.14 # without means enabled %bcond_with doc # 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. %if 0%{?rhel} %bcond_with pythran %bcond_with pooch %bcond_with tests %else %bcond_without pythran %bcond_without pooch %bcond_without tests %endif # The code is not safe to build with LTO %global _lto_cflags %{nil} %ifarch %{ix86} # On i686, there is a confusion whether Fortran INTEGER should be # translated as int or long. # %global build_type_safety_c 2 %endif # 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 build_backend_args %{shrink: -Csetup-args=-Dblas=%{blaslib}%{blasvar} -Csetup-args=-Dlapack=%{blaslib}%{blasvar} %{!?with_pythran:-Csetup-args=-Duse-pythran=false} } Summary: Scientific Tools for Python Name: python%{python3_pkgversion}-scipy Version: 1.16.2 Release: 1%{?dist} # 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/_direct # 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: https://scipy.org/ Source0: https://github.com/scipy/scipy/releases/download/v%{version}/scipy-%{version}.tar.gz # Vendor a newer meson version to avoid compatibility issues with old meson available in RHEL 9 Source2: https://github.com/mesonbuild/meson/releases/download/1.4.1/meson-1.4.1.tar.gz # Compatibility patch for meson 1.4.1 # Patch: compatibility-with-meson-1.4.1.patch BuildRequires: %{blaslib}-devel BuildRequires: gcc-gfortran, gcc-c++ BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-pybind11-devel BuildRequires: python%{python3_pkgversion}-devel, python%{python3_pkgversion}-numpy-f2py # for %%pyproject_buildrequires -p: BuildRequires: pyproject-rpm-macros >= 1.15 %ifarch %{power64} # scipy segfaults with netlib/atlas on ppc64le BuildRequires: flexiblas-openblas-openmp %endif %if %{with doc} BuildRequires: python%{python3_pkgversion}-sphinx BuildRequires: python%{python3_pkgversion}-matplotlib BuildRequires: python%{python3_pkgversion}-numpydoc %endif %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 %if %{with tests} %package -n python%{python3_pkgversion}-scipy-tests Summary: Scientific Tools for Python - test files Requires: python%{python3_pkgversion}-scipy = %{version}-%{release} Requires: python%{python3_pkgversion}-pytest %description -n python%{python3_pkgversion}-scipy-tests Scipy test files %endif %prep %autosetup -p1 -n scipy-%{version}%{?rcver} # Extract and set up vendored meson tar -xzf %{SOURCE2} export PATH="$PWD/meson-1.4.1:$PATH" export PYTHONPATH="$PWD/meson-1.4.1:$PYTHONPATH" # Patch vendored meson to recognize cython3.14 executable sed -i "s/\['cython', 'cython3'\]/\['cython', 'cython3', 'cython-3.14'\]/" meson-1.4.1/mesonbuild/compilers/detect.py # Adjust minimal meson version sed -i "s/1.5.0/1.4.1/" meson.build sed -i "s/>=1.5.0/>=1.4.1/" subprojects/xsf/meson.build sed -i "s/>= 1.5.0/>= 1.4.1/" subprojects/boost_math/meson.build sed -i "s/>= 1.5.0/>= 1.4.1/" subprojects/qhull_r/meson.build # Fix generator depends arguments for meson 1.4.1 compatibility sed -i 's/depends : \[_cython_tree, __init__py, _cy_array_utils_pxd, cython_lapack_pxd\]/depends : [_cython_tree, __init__py, _cy_array_utils_pxd, cython_linalg]/' scipy/linalg/meson.build sed -i 's/depends : \[_cython_tree, __init__py, cython_blas_pxd\]/depends : [_cython_tree, __init__py, cython_linalg]/' scipy/linalg/meson.build sed -i 's/depends : \[_cython_tree, cython_blas_pxd, cython_optimize_pxd, _dummy_init_optimize\]/depends : [_cython_tree, cython_linalg, cython_optimize_pxd, _dummy_init_optimize]/' scipy/optimize/meson.build sed -i 's/cython_special\[0\]/cython_special/g' scipy/special/meson.build sed -i 's/depends : \[_cython_tree, _spatial_pxd, _lib_pxd, cython_lapack_pxd\]/depends : [_cython_tree, _spatial_pxd, _lib_pxd, cython_linalg]/' scipy/spatial/meson.build sed -i "s/'f2py'/'f2py3.14'/" tools/generate_f2pymod.py # Disable the entire block of lines 202-214 # For some reason meson is complaining about f2py3.14 # even though it is installed # https://github.com/scipy/scipy/blob/v1.15.3/scipy/meson.build#L202-L214 sed -i '/^f2py = find_program/,/^endif$/s/^/# /' scipy/meson.build %if %{without pythran} # Remove pythran dependency if not explicitly required sed -i '/pythran/d' pyproject.toml %else # Relax it otherwise sed -i 's/pythran>=0.14.0,<0.18.0/pythran>=0.14.0/' pyproject.toml %endif %if %{without pooch} sed -i '/pooch/d' pyproject.toml %endif rm $(grep -rl '/\* Generated by Cython') PKG-INFO # Do not do benchmarking, coverage, or timeout testing for RPM builds sed -Ei '/^[[:blank:]]*"(asv|pytest-cov|pytest-timeout)"/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 # Loosen the upper bound on numpy sed -i "/numpy/s/,<2\.3//" pyproject.toml # Loosen the lower bound on array-api-strict sed -i "/array-api-strict/s/>=2\.3\.1/>=2/" pyproject.toml # Loosen the upper bound on Cython # This can be removed from scipy >= 1.16.0 sed -i '/Cython/s/,<3\.1\.0//' pyproject.toml %generate_buildrequires export PATH="$PWD/bin:$PWD/meson-1.4.1:$PATH" export PYTHONPATH="$PWD/meson-1.4.1:$PYTHONPATH" %pyproject_buildrequires -p %{?with_tests:-x test} %{build_backend_args} %build export PATH="$PWD/bin:$PWD/meson-1.4.1:$PATH" export PYTHONPATH="$PWD/meson-1.4.1:$PYTHONPATH" %pyproject_wheel %{build_backend_args} %if %{with doc} for PY in %{python3_pkgversion}; do 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 done %endif %install %pyproject_install %pyproject_save_files scipy # Some files got ambiguous python shebangs, we fix them after everything else is done %py3_shebang_fix %{buildroot}%{python3_sitearch} %check %if %{with tests} # check against the reference BLAS/LAPACK export FLEXIBLAS=netlib %ifarch %{power64} # scipy segfaults with netlib/atlas on ppc64le export FLEXIBLAS=openblas-openmp %endif # TestDatasets try to download from the internet SKIP_ALL="not TestDatasets" export PYTEST_ADDOPTS="-k '$SKIP_ALL'" %ifarch aarch64 # TestConstructUtils::test_concatenate_int32_overflow is flaky on aarch64 export PYTEST_ADDOPTS="-k '$SKIP_ALL and \ not test_concatenate_int32_overflow'" %endif %ifarch s390x # https://bugzilla.redhat.com/show_bug.cgi?id=1959353 export PYTEST_ADDOPTS="-k '$SKIP_ALL and \ not test_distance_transform_cdt05'" %endif %ifarch x86_64 %if 0%{?rhel} # test_minimize_constrained started failing on ELN without any direct changes to scipy export PYTEST_ADDOPTS="-k '$SKIP_ALL and \ not test_gh7799 and \ not test_minimize_constrained'" %endif %endif %ifarch i686 # https://github.com/scipy/scipy/issues/17213 export PYTEST_ADDOPTS="-k '$SKIP_ALL and \ not test_examples and \ not test_shifts and \ not test_svdp and \ not TestMMIO and \ not test_mmio and \ not test_threadpoolctl and \ not test_gh11389 and \ not test_gh18123 and \ not test_gh_17782_segfault and \ not test_svd_gesdd_nofegfault'" %endif %ifarch riscv64 export PYTEST_ADDOPTS="-k '$SKIP_ALL and \ not TestSchur and \ not test_gejsv_general and \ not test_kendall_p_exact_large and \ not test_gejsv_edge_arguments and \ not test_gh12999 and \ not test_propack and \ not test_milp and \ not test_gejsv_NAG'" %endif pushd %{buildroot}/%{python3_sitearch} # Ignoring the datasets tests as we don't have the optional pooch # dependency on RHEL. %{pytest} %{!?with_pooch:--ignore=scipy/datasets/tests/test_data.py} scipy %{?!rhel:--numprocesses=auto} # Remove test remnants rm -rf gram{A,B} rm -rf .pytest_cache popd %endif %files -n python%{python3_pkgversion}-scipy -f %{pyproject_files} %license LICENSE.txt LICENSES_bundled.txt %exclude %{python3_sitearch}/scipy/*/tests/ %exclude %{python3_sitearch}/scipy/*/*/tests/ %exclude %{python3_sitearch}/scipy/*/*/*/tests/ %exclude %{python3_sitearch}/scipy/*/*/*/*/tests/ %if %{with tests} %files -n python3-scipy-tests %{python3_sitearch}/scipy/*/tests/ %{python3_sitearch}/scipy/*/*/tests/ %{python3_sitearch}/scipy/*/*/*/tests/ %{python3_sitearch}/scipy/*/*/*/*/tests/ %endif %changelog * Fri Oct 24 2025 Tomáš Hrnčiar - 1.16.2-1 - Initial package - Fedora contributions by: Antonio Trande Benjamin A. Beasley Bill Nottingham Björn Esser Charalampos Stratakis Christian Dersch David Abdurachmanov David Malcolm Deji Akingunola Dennis Gilmore dmalcolm Elliott Sales de Andrade Florian Weimer Gwyn Ciesla Ignacio Vazquez-Abrams Igor Gnatenko Iñaki Úcar Jef Spaleta Jerry James Jesse Keating Jitka Plesnikova Jonathan Wakely Kalev Lember Karolina Surma Kevin Fenzi Lumir Balhar Mamoru TASAKA Marcel Plch Maxwell G 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 Yaakov Selkowitz Zbigniew Jędrzejewski-Szmek