python3.11-scipy/python3.11-scipy.spec
Charalampos Stratakis d384cbdb91 RHEL: Convert from Fedora for the Python 3.11 stack in RHEL
Resolves: rhbz#2157723
2023-02-11 18:05:42 +01:00

209 lines
6.7 KiB
RPMSpec

%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 <cstratak@redhat.com> - 1.8.1-1
- Initial package
- Fedora contributions by:
Antonio Trande <anto.trande@gmail.com>
Bill Nottingham <notting@fedoraproject.org>
Björn Esser <me@besser82.io>
Charalampos Stratakis <cstratak@redhat.com>
Christian Dersch <lupinix@mailbox.org>
David Malcolm <dmalcolm@redhat.com>
Deji Akingunola <deji@fedoraproject.org>
Dennis Gilmore <dennis@ausil.us>
Elliott Sales de Andrade <quantum.analyst@gmail.com>
Ignacio Vazquez-Abrams <ivazquez@fedoraproject.org>
Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Iñaki Úcar <iucar@fedoraproject.org>
Jef Spaleta <jspaleta@fedoraproject.org>
Jesse Keating <jkeating@fedoraproject.org>
Jitka Plesnikova <jplesnik@redhat.com>
Jonathan Wakely <jwakely@redhat.com>
Jon Ciesla <limb@fedoraproject.org>
Kalev Lember <klember@redhat.com>
Kevin Fenzi <kevin@scrye.com>
Lumir Balhar <lbalhar@redhat.com>
Mamoru TASAKA <mtasaka@fedoraproject.org>
Marcel Plch <mplch@redhat.com>
Miro Hrončok <miro@hroncok.cz>
Nikola Forró <nforro@redhat.com>
Nils Philippsen <nils@redhat.com>
Orion Poplawski <orion@nwra.com>
Peter Robinson <pbrobinson@fedoraproject.org>
Petr Viktorin <pviktori@redhat.com>
Robert Kuska <rkuska@redhat.com>
Than Ngo <than@redhat.com>
Thomas Spura <thomas.spura@gmail.com>
Tomas Tomecek <ttomecek@redhat.com>
Toshio Kuratomi <toshio@fedoraproject.org>
Troy Dawson <tdawson@fedoraproject.org>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>