%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.8.1 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 # https://bugzilla.redhat.com/show_bug.cgi?id=2099102 # https://github.com/scipy/scipy/issues/16527 # https://github.com/scipy/scipy/pull/16528 Patch0: scipy-1.8.1-syevr-operator-order-explicit.patch # Fix test_moments failing test # https://github.com/scipy/scipy/pull/16593 Patch1: scipy-1.8.1-test_moments-benchmark.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 # default test timeout TIMEOUT=500 # skip failing TestSchur, it needs to be fixed to account for different # (but still valid) results from lapack >= 3.10 # see: https://github.com/Reference-LAPACK/lapack/issues/628 export PYTEST_ADDOPTS="-k 'not TestSchur'" %ifarch s390x # skip failing tests on s390x for now export PYTEST_ADDOPTS="-k 'not TestSchur and \ not (TestNoData and test_nodata) and \ not test_solve_discrete_are'" # some tests (namely test_logpdf_overflow) tend to run for a long time on s390x TIMEOUT=1000 %endif %ifarch aarch64 || ppc64le # https://bugzilla.redhat.com/show_bug.cgi?id=1959353 export PYTEST_ADDOPTS="-k 'not TestSchur and not test_solve_discrete_are'" TIMEOUT=1000 %endif %ifarch x86_64 # skip also failing test_sygst for now export PYTEST_ADDOPTS="-k 'not TestSchur and not test_sygst'" %endif %ifarch i686 || armv7hl # skip also test_cython_api: https://bugzilla.redhat.com/show_bug.cgi?id=2068496 export PYTEST_ADDOPTS="-k 'not TestSchur and not test_sygst and not test_cython_api'" %endif pushd %{buildroot}/%{python3_sitearch} %{pytest} 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 * 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 Peter Robinson Petr Viktorin Robert Kuska Than Ngo Thomas Spura Tomas Tomecek Toshio Kuratomi Troy Dawson Zbigniew Jędrzejewski-Szmek