python3.12-numpy/python3.12-numpy.spec

209 lines
7.8 KiB
RPMSpec

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