Use pyproject macros instead of the deprecated py3 macros

This commit is contained in:
Jerry James 2023-11-28 15:44:18 +01:00 committed by Nikola Forró
parent 64440ae7d2
commit 0bfceb8704

View File

@ -54,16 +54,15 @@ BuildRequires: gcc-gfortran, swig, gcc-c++
BuildRequires: qhull-devel BuildRequires: qhull-devel
BuildRequires: pybind11-devel BuildRequires: pybind11-devel
BuildRequires: python3-pybind11 >= 2.4.0
BuildRequires: python3-numpy, python3-devel, python3-numpy-f2py BuildRequires: python3-numpy, python3-devel, python3-numpy-f2py
BuildRequires: python3-pooch
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
BuildRequires: python3-Cython
BuildRequires: python3-pytest BuildRequires: python3-pytest
BuildRequires: python3-pytest-timeout
%if ! 0%{?rhel} %if ! 0%{?rhel}
BuildRequires: python3-pytest-xdist BuildRequires: python3-pytest-xdist
%endif %endif
BuildRequires: python3-pytest-timeout BuildRequires: python3-pooch
%if %{with pythran} %if %{with pythran}
BuildRequires: pythran BuildRequires: pythran
@ -91,7 +90,6 @@ leading scientists and engineers.}
%package -n python3-scipy %package -n python3-scipy
Summary: Scientific Tools for Python Summary: Scientific Tools for Python
Requires: python3-numpy, python3-f2py, python3-pooch Requires: python3-numpy, python3-f2py, python3-pooch
%{?python_provide:%python_provide python3-scipy}
Provides: bundled(arpack) = 3.3.0 Provides: bundled(arpack) = 3.3.0
Provides: bundled(biasedurn) Provides: bundled(biasedurn)
Provides: bundled(boost-math) Provides: bundled(boost-math)
@ -125,21 +123,10 @@ Scipy test files
%prep %prep
%autosetup -p1 -n %{name}-%{version}%{?rcver} %autosetup -p1 -n %{name}-%{version}%{?rcver}
cat > site.cfg << EOF cat >> pyproject.toml << EOF
[amd] [tool.meson-python.args]
library_dirs = %{_libdir} setup = ['-Dblas=%{blaslib}%{blasvar}', '-Dlapack=%{blaslib}%{blasvar}']
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 EOF
# Docs won't build unless the .dat files are specified here # Docs won't build unless the .dat files are specified here
@ -154,43 +141,67 @@ for f in $(grep -Frl numpy.distutils); do
rm $f.orig rm $f.orig
done done
# Do not do benchmarking or coverage testing for RPM builds
sed -i '/^[[:blank:]]*"(asv|pytest-cov)"/d' pyproject.toml
# No scikit-umfpack in Fedora
sed -i '/^[[:blank:]]*"scikit-umfpack"/d' pyproject.toml
# No pytest-xdist in RHEL
%if 0%{?rhel}
sed -i '/^[[:blank:]]*"pytest-xdist"/d' pyproject.toml
%endif
# Remove pythran dependency if not explicitly required
%if %{without pythran}
sed -i '/pythran/d' pyproject.toml
%endif
# Loosen the lower bound on numpy
sed -i "/numpy.*python_version=='3.12'/s/1\.26\.0/1\.24\.4/" pyproject.toml
# Loosen the upper bound on meson-python
sed -i '/meson-python/s/0\.15\.0/0\.16\.0/' pyproject.toml
# Loosen the upper bound on Cython
sed -i '/Cython/s/3\.0/3\.1/' pyproject.toml
# Loosen the upper bound on pybind11
sed -i '/pybind11/s/2\.11\.1/2.12.0/' pyproject.toml
# Work around failure to detect open_memstream. In glibc, open_memstream is # Work around failure to detect open_memstream. In glibc, open_memstream is
# not a real function. It is a weak alias to __open_memstream. # not a real function. It is a weak alias to __open_memstream.
sed -i "s/\('has_openmemstream', \)'0'/\1'1'/" scipy/_lib/meson.build sed -i "s/\('has_openmemstream', \)'0'/\1'1'/" scipy/_lib/meson.build
%generate_buildrequires
%pyproject_buildrequires -R
%build %build
export SCIPY_USE_PYTHRAN=0%{?with_pythran} export SCIPY_USE_PYTHRAN=0%{?with_pythran}
%pyproject_wheel
for PY in %{python3_version}; do
# Adding -fallow-argument-mismatch workaround for https://github.com/scipy/scipy/issues/11611
env CFLAGS="$RPM_OPT_FLAGS -lm" \
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
FFLAGS="$RPM_OPT_FLAGS -fPIC -fallow-argument-mismatch" \
%else
FFLAGS="$RPM_OPT_FLAGS -fPIC" \
%endif
LDFLAGS="%{__global_ldflags}" \
%{_bindir}/python$PY _setup.py config_fc \
--fcompiler=gnu95 --noarch \
build
%if %{with doc} %if %{with doc}
for PY in %{python3_version}; do
pushd doc pushd doc
export PYTHONPATH=$(echo ../build/lib.linux-*-$PY/) export PYTHONPATH=$(echo ../build/lib.linux-*-$PY/)
make html SPHINXBUILD=sphinx-build-$PY make html SPHINXBUILD=sphinx-build-$PY
rm -rf build/html/.buildinfo rm -rf build/html/.buildinfo
mv build build-$PY mv build build-$PY
popd popd
%endif
done done
%endif
%install %install
export SCIPY_USE_PYTHRAN=0%{?with_pythran} export SCIPY_USE_PYTHRAN=0%{?with_pythran}
%pyproject_install
%pyproject_save_files scipy
%py3_install
# Some files got ambiguous python shebangs, we fix them after everything else is done # Some files got ambiguous python shebangs, we fix them after everything else is done
%py3_shebang_fix %{buildroot}%{python3_sitearch} %py3_shebang_fix %{buildroot}%{python3_sitearch}
# Fix executable bits
chmod 0755 %{buildroot}%{python3_sitearch}/scipy/sparse/linalg/_isolve/tests/test_gcrotmk.py
%check %check
# check against the reference BLAS/LAPACK # check against the reference BLAS/LAPACK
export FLEXIBLAS=netlib export FLEXIBLAS=netlib
@ -267,10 +278,8 @@ rm -rf gram{A,B}
rm -rf .pytest_cache rm -rf .pytest_cache
popd popd
%files -n python3-scipy %files -n python3-scipy -f %{pyproject_files}
%license LICENSE.txt %license LICENSE.txt
%{python3_sitearch}/scipy/
%{python3_sitearch}/*.egg-info
%exclude %{python3_sitearch}/scipy/*/tests/ %exclude %{python3_sitearch}/scipy/*/tests/
%exclude %{python3_sitearch}/scipy/*/*/tests/ %exclude %{python3_sitearch}/scipy/*/*/tests/
%exclude %{python3_sitearch}/scipy/*/*/*/tests/ %exclude %{python3_sitearch}/scipy/*/*/*/tests/
@ -297,6 +306,7 @@ popd
- Disable LTO - Disable LTO
- Pythran works on 32-bit architectures again - Pythran works on 32-bit architectures again
- Fix detection of open_memstream - Fix detection of open_memstream
- Use pyproject macros instead of the deprecated py3 macros
* Wed Jul 12 2023 psimovec <psimovec@redhat.com> - 1.11.1-1 * Wed Jul 12 2023 psimovec <psimovec@redhat.com> - 1.11.1-1
- New upstream release 1.11.1 - New upstream release 1.11.1