Blame SPECS/python3.11-numpy.spec

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