From 0bfceb8704131e0d34c95ab732db093e05db46c8 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Tue, 28 Nov 2023 15:44:18 +0100 Subject: [PATCH] Use pyproject macros instead of the deprecated py3 macros --- scipy.spec | 84 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/scipy.spec b/scipy.spec index 407e74d..4406c44 100644 --- a/scipy.spec +++ b/scipy.spec @@ -54,16 +54,15 @@ BuildRequires: gcc-gfortran, swig, gcc-c++ BuildRequires: qhull-devel BuildRequires: pybind11-devel -BuildRequires: python3-pybind11 >= 2.4.0 BuildRequires: python3-numpy, python3-devel, python3-numpy-f2py -BuildRequires: python3-pooch BuildRequires: python3-setuptools -BuildRequires: python3-Cython + BuildRequires: python3-pytest +BuildRequires: python3-pytest-timeout %if ! 0%{?rhel} BuildRequires: python3-pytest-xdist %endif -BuildRequires: python3-pytest-timeout +BuildRequires: python3-pooch %if %{with pythran} BuildRequires: pythran @@ -91,7 +90,6 @@ leading scientists and engineers.} %package -n python3-scipy Summary: Scientific Tools for Python Requires: python3-numpy, python3-f2py, python3-pooch -%{?python_provide:%python_provide python3-scipy} Provides: bundled(arpack) = 3.3.0 Provides: bundled(biasedurn) Provides: bundled(boost-math) @@ -125,21 +123,10 @@ Scipy test files %prep %autosetup -p1 -n %{name}-%{version}%{?rcver} -cat > site.cfg << EOF +cat >> pyproject.toml << EOF -[amd] -library_dirs = %{_libdir} -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} +[tool.meson-python.args] +setup = ['-Dblas=%{blaslib}%{blasvar}', '-Dlapack=%{blaslib}%{blasvar}'] EOF # 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 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 # not a real function. It is a weak alias to __open_memstream. sed -i "s/\('has_openmemstream', \)'0'/\1'1'/" scipy/_lib/meson.build +%generate_buildrequires +%pyproject_buildrequires -R + %build export SCIPY_USE_PYTHRAN=0%{?with_pythran} +%pyproject_wheel +%if %{with doc} 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} pushd doc export PYTHONPATH=$(echo ../build/lib.linux-*-$PY/) make html SPHINXBUILD=sphinx-build-$PY rm -rf build/html/.buildinfo mv build build-$PY popd - %endif done +%endif %install 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 %py3_shebang_fix %{buildroot}%{python3_sitearch} +# Fix executable bits +chmod 0755 %{buildroot}%{python3_sitearch}/scipy/sparse/linalg/_isolve/tests/test_gcrotmk.py + %check # check against the reference BLAS/LAPACK export FLEXIBLAS=netlib @@ -267,10 +278,8 @@ rm -rf gram{A,B} rm -rf .pytest_cache popd -%files -n python3-scipy +%files -n python3-scipy -f %{pyproject_files} %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/ @@ -297,6 +306,7 @@ popd - Disable LTO - Pythran works on 32-bit architectures again - Fix detection of open_memstream +- Use pyproject macros instead of the deprecated py3 macros * Wed Jul 12 2023 psimovec - 1.11.1-1 - New upstream release 1.11.1