Blame SPECS/python3.11-numpy.spec

3c2930
%global __python3 /usr/bin/python3.11
3c2930
%global python3_pkgversion 3.11
3c2930
3c2930
#uncomment next line for a release candidate or a beta
3c2930
#%%global relc rc1
3c2930
3c2930
# RHEL: Tests disabled due to missing dependencies
3c2930
%bcond_with tests
3c2930
3c2930
%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9
3c2930
%global blaslib flexiblas
3c2930
%global blasvar %{nil}
3c2930
%else
3c2930
%global blaslib openblas
3c2930
%global blasvar p
3c2930
%endif
3c2930
3c2930
%global modname numpy
3c2930
3c2930
Name:           python%{python3_pkgversion}-numpy
3c2930
Version:        1.23.5
3c2930
Release:        1%{?dist}
3c2930
Summary:        A fast multidimensional array facility for Python
3c2930
3c2930
# Everything is BSD except for class SafeEval in numpy/lib/utils.py which is Python
3c2930
License:        BSD and Python and ASL 2.0
3c2930
URL:            http://www.numpy.org/
3c2930
Source0:        https://github.com/%{modname}/%{modname}/releases/download/v%{version}/%{modname}-%{version}.tar.gz
3c2930
3c2930
BuildRequires:  python%{python3_pkgversion}-devel
3c2930
BuildRequires:  python%{python3_pkgversion}-rpm-macros
3c2930
BuildRequires:  python%{python3_pkgversion}-setuptools
3c2930
BuildRequires:  python%{python3_pkgversion}-Cython
3c2930
BuildRequires:  gcc-gfortran gcc gcc-c++
3c2930
BuildRequires:  lapack-devel
3c2930
%if %{with tests}
3c2930
BuildRequires:  python%{python3_pkgversion}-hypothesis
3c2930
BuildRequires:  python%{python3_pkgversion}-pytest
3c2930
BuildRequires:  python%{python3_pkgversion}-test
3c2930
BuildRequires:  python%{python3_pkgversion}-typing-extensions
3c2930
%endif
3c2930
BuildRequires: %{blaslib}-devel
3c2930
BuildRequires: chrpath
3c2930
3c2930
%description
3c2930
NumPy is a general-purpose array-processing package designed to
3c2930
efficiently manipulate large multi-dimensional arrays of arbitrary
3c2930
records without sacrificing too much speed for small multi-dimensional
3c2930
arrays.  NumPy is built on the Numeric code base and adds features
3c2930
introduced by numarray as well as an extended C-API and the ability to
3c2930
create arrays of arbitrary type.
3c2930
3c2930
There are also basic facilities for discrete fourier transform,
3c2930
basic linear algebra and random number generation. Also included in
3c2930
this package is a version of f2py that works properly with NumPy.
3c2930
3c2930
3c2930
%package -n python%{python3_pkgversion}-numpy-f2py
3c2930
Summary:        f2py for numpy
3c2930
Requires:       python%{python3_pkgversion}-numpy%{?_isa} = %{version}-%{release}
3c2930
Requires:       python%{python3_pkgversion}-devel
3c2930
Provides:       python%{python3_pkgversion}-f2py = %{version}-%{release}
3c2930
3c2930
# Require alternatives version that implements the --keep-foreign flag
3c2930
Requires(postun): alternatives >= 1.19.1-1
3c2930
# python3.11 installs the alternatives master symlink to which we attach a slave
3c2930
Requires: python%{python3_pkgversion}
3c2930
Requires(post): python%{python3_pkgversion}
3c2930
Requires(postun): python%{python3_pkgversion}
3c2930
3c2930
%description -n python%{python3_pkgversion}-numpy-f2py
3c2930
This package includes a version of f2py that works properly with NumPy.
3c2930
3c2930
%prep
3c2930
%autosetup -n %{modname}-%{version} -p1
3c2930
3c2930
# Force re-cythonization (ifed for PKG-INFO presence in setup.py)
3c2930
rm PKG-INFO
3c2930
3c2930
# openblas is provided by flexiblas by default; otherwise,
3c2930
# Use openblas pthreads as recommended by upstream (see comment in site.cfg.example)
3c2930
cat >> site.cfg <
3c2930
[openblas]
3c2930
libraries = %{blaslib}%{blasvar}
3c2930
library_dirs = %{_libdir}
3c2930
EOF
3c2930
3c2930
%build
3c2930
%set_build_flags
3c2930
3c2930
env OPENBLAS=%{_libdir} \
3c2930
    BLAS=%{_libdir} \
3c2930
    LAPACK=%{_libdir} CFLAGS="%{optflags}" \
3c2930
    %{__python3} setup.py build
3c2930
3c2930
%install
3c2930
#%%{__python3} setup.py install -O1 --skip-build --root %%{buildroot}
3c2930
# skip-build currently broken, this works around it for now
3c2930
env OPENBLAS=%{_libdir} \
3c2930
    FFTW=%{_libdir} BLAS=%{_libdir} \
3c2930
    LAPACK=%{_libdir} CFLAGS="%{optflags}" \
3c2930
    %{__python3} setup.py install --root %{buildroot} --prefix=%{_prefix}
3c2930
pushd %{buildroot}%{_bindir} &> /dev/null
3c2930
# Remove unversioned binaries
3c2930
rm f2py
3c2930
rm f2py3
3c2930
popd &> /dev/null
3c2930
3c2930
# All ghost files controlled by alternatives need to exist for the files
3c2930
# section check to succeed
3c2930
touch %{buildroot}%{_bindir}/f2py3
3c2930
3c2930
# distutils from setuptools don't have the patch that was created to avoid standard runpath here
3c2930
# we strip it manually instead
3c2930
# ERROR   0001: file '...' contains a standard runpath '/usr/lib64' in [/usr/lib64]
3c2930
chrpath --delete %{buildroot}%{python3_sitearch}/%{modname}/core/_multiarray_umath.*.so
3c2930
chrpath --delete %{buildroot}%{python3_sitearch}/%{modname}/linalg/lapack_lite.*.so
3c2930
chrpath --delete %{buildroot}%{python3_sitearch}/%{modname}/linalg/_umath_linalg.*.so
3c2930
3c2930
%check
3c2930
%if %{with tests}
3c2930
export PYTHONPATH=%{buildroot}%{python3_sitearch}
3c2930
# test_ppc64_ibm_double_double128 is unnecessary now that ppc64le has switched long doubles to IEEE format.
3c2930
# https://github.com/numpy/numpy/issues/21094
3c2930
%ifarch %{ix86}
3c2930
# Weird RuntimeWarnings on i686, similar to https://github.com/numpy/numpy/issues/13173
3c2930
# Some tests also overflow on 32bit
3c2930
%global ix86_k and not test_vector_matrix_values and not test_matrix_vector_values and not test_identityless_reduction_huge_array and not (TestKind and test_all)
3c2930
%endif
3c2930
%{__python3} runtests.py -v --no-build -- -ra -k 'not test_ppc64_ibm_double_double128 %{?ix86_k}'
3c2930
%endif
3c2930
3c2930
%post -n python%{python3_pkgversion}-numpy-f2py
3c2930
alternatives --add-slave python3 %{_bindir}/python%{python3_version} \
3c2930
    %{_bindir}/f2py3 \
3c2930
    f2py3 \
3c2930
    %{_bindir}/f2py%{python3_version}
3c2930
3c2930
%postun -n python%{python3_pkgversion}-numpy-f2py
3c2930
# Do this only during uninstall process (not during update)
3c2930
if [ $1 -eq 0 ]; then
3c2930
   alternatives --keep-foreign --remove-slave python3 %{_bindir}/python%{python3_version} \
3c2930
       f2py3
3c2930
fi
3c2930
3c2930
3c2930
%files -n python%{python3_pkgversion}-numpy
3c2930
%license LICENSE.txt
3c2930
%doc THANKS.txt site.cfg.example
3c2930
%{python3_sitearch}/%{modname}/__pycache__/
3c2930
%dir %{python3_sitearch}/%{modname}
3c2930
%{python3_sitearch}/%{modname}/*.py*
3c2930
%{python3_sitearch}/%{modname}/core
3c2930
%{python3_sitearch}/%{modname}/distutils
3c2930
%{python3_sitearch}/%{modname}/doc
3c2930
%{python3_sitearch}/%{modname}/fft
3c2930
%{python3_sitearch}/%{modname}/lib
3c2930
%{python3_sitearch}/%{modname}/linalg
3c2930
%{python3_sitearch}/%{modname}/ma
3c2930
%{python3_sitearch}/%{modname}/random
3c2930
%{python3_sitearch}/%{modname}/testing
3c2930
%{python3_sitearch}/%{modname}/tests
3c2930
%{python3_sitearch}/%{modname}/compat
3c2930
%{python3_sitearch}/%{modname}/matrixlib
3c2930
%{python3_sitearch}/%{modname}/polynomial
3c2930
%{python3_sitearch}/%{modname}-*.egg-info
3c2930
%exclude %{python3_sitearch}/%{modname}/LICENSE.txt
3c2930
%{python3_sitearch}/%{modname}/__init__.pxd
3c2930
%{python3_sitearch}/%{modname}/__init__.cython-30.pxd
3c2930
%{python3_sitearch}/%{modname}/py.typed
3c2930
%{python3_sitearch}/%{modname}/typing/
3c2930
%{python3_sitearch}/%{modname}/array_api/
3c2930
%{python3_sitearch}/%{modname}/_pyinstaller/
3c2930
%{python3_sitearch}/%{modname}/_typing/
3c2930
3c2930
%files -n python%{python3_pkgversion}-numpy-f2py
3c2930
%{_bindir}/f2py%{python3_pkgversion}
3c2930
%ghost %{_bindir}/f2py3
3c2930
%{python3_sitearch}/%{modname}/f2py
3c2930
3c2930
3c2930
%changelog
3c2930
* Fri Dec 02 2022 Charalampos Stratakis <cstratak@redhat.com> - 1.23.5-1
3c2930
- Initial package
3c2930
- Fedora contributions by:
3c2930
      Bill Nottingham <notting@fedoraproject.org>
3c2930
      Charalampos Stratakis <cstratak@redhat.com>
3c2930
      Christian Dersch <lupinix@mailbox.org>
3c2930
      Dan Horák <sharkcz@fedoraproject.org>
3c2930
      David Malcolm <dmalcolm@redhat.com>
3c2930
      David Tardon <dtardon@redhat.com>
3c2930
      Deji Akingunola <deji@fedoraproject.org>
3c2930
      Dennis Gilmore <dennis@ausil.us>
3c2930
      Elliott Sales de Andrade <quantum.analyst@gmail.com>
3c2930
      Gwyn Ciesla <limburgher@gmail.com>
3c2930
      Ignacio Vazquez-Abrams <ivazquez@fedoraproject.org>
3c2930
      Iñaki Úcar <iucar@fedoraproject.org>
3c2930
      Iryna Shcherbina <shcherbina.iryna@gmail.com>
3c2930
      Jarod Wilson <jwilson@fedoraproject.org>
3c2930
      Jaromir Capik <jcapik@redhat.com>
3c2930
      Jef Spaleta <jspaleta@fedoraproject.org>
3c2930
      Jesse Keating <jkeating@fedoraproject.org>
3c2930
      Jon Ciesla <limb@fedoraproject.org>
3c2930
      Kalev Lember <klember@redhat.com>
3c2930
      Karolina Surma <ksurma@redhat.com>
3c2930
      Lumir Balhar <lbalhar@redhat.com>
3c2930
      Merlin Mathesius <mmathesi@redhat.com>
3c2930
      Miro Hrončok <miro@hroncok.cz>
3c2930
      Nikola Forró <nforro@redhat.com>
3c2930
      Orion Poplawski <orion@nwra.com>
3c2930
      Pavel Šimovec <psimovec@redhat.com>
3c2930
      Peter Robinson <pbrobinson@fedoraproject.org>
3c2930
      Robert Kuska <rkuska@redhat.com>
3c2930
      Simone Caronni <negativo17@gmail.com>
3c2930
      Thomas Spura <tomspur@fedoraproject.org>
3c2930
      Tomáš Hrnčiar <thrnciar@redhat.com>
3c2930
      Tomas Orsava <torsava@redhat.com>
3c2930
      Tomas Tomecek <ttomecek@redhat.com>
3c2930
      Ville Skyttä <scop@fedoraproject.org>