Blame SPECS/python3.11-numpy.spec

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