diff --git a/.gitignore b/.gitignore index 91f5c0e..dc7b2d7 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /nipy-e75449933dc063c1f36991d5ceb44a1b77e78c71.tar.gz /nipy-a2e068bec399580573d514f8a9cd11cac494a7e9.tar.gz /nipy-961fa38508394a209f8964f6e6efc613972f6038.tar.gz +/nipy-e5e063b09d094ff79d2089261828fd2b2c843ab6.tar.gz diff --git a/0001-Downstream-only-allow-numpy-1.24.patch b/0001-Downstream-only-allow-numpy-1.24.patch index 222550b..83ae82b 100644 --- a/0001-Downstream-only-allow-numpy-1.24.patch +++ b/0001-Downstream-only-allow-numpy-1.24.patch @@ -1,4 +1,4 @@ -From 6fbdf145c4b08134e6ae118e10f5f0243bca941c Mon Sep 17 00:00:00 2001 +From 5857827a7c94fc9ca1f99dc9b8f3a87c132ec78d Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 21 Sep 2023 13:53:48 -0400 Subject: [PATCH] Downstream-only: allow numpy 1.24 @@ -13,12 +13,12 @@ much more tightly controlled in a distribution package 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml -index 3d818f76..ef93c8a0 100644 +index 7d5d3b80..4b95126a 100644 --- a/pyproject.toml +++ b/pyproject.toml -@@ -3,7 +3,7 @@ requires = [ +@@ -5,7 +5,7 @@ requires = [ "setuptools", - "cython<3", + "cython>=3", # Newer than NEP29-minimum: compile against oldest numpy available - "numpy>=1.25; python_version > '3.8'", + "numpy>=1.24; python_version > '3.8'", diff --git a/python-nipy.spec b/python-nipy.spec index 8d2b398..c9cb5f8 100644 --- a/python-nipy.spec +++ b/python-nipy.spec @@ -1,22 +1,7 @@ %bcond tests 1 -# The tests fail overall due to an ERROR: -# TypeError: stat: path should be string, bytes, os.PathLike or integer, not -# NoneType -# For the time being, we ignore the exit status of the test suite, because we -# can’t figure out how to fix or ignore the error (but the actual tests pass). -%bcond ignore_test_failure 1 -# Sphinx-generated HTML documentation is not suitable for packaging; see -# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion. -# -# We can generate PDF documentation as a substitute. -# -# Currently, there are several issues that still prevent us from successfully -# building the documentation even with a few obvious patches. See: -# https://github.com/nipy/nipy/pull/503#issuecomment-1421508175 -%bcond doc_pdf 0 -%global commit 961fa38508394a209f8964f6e6efc613972f6038 -%global snapdate 20230923 +%global commit e5e063b09d094ff79d2089261828fd2b2c843ab6 +%global snapdate 20231006 Name: python-nipy Version: 0.5.0^%{snapdate}git%(c='%{commit}'; echo "${c:0:7}") @@ -41,31 +26,15 @@ Source14: nipy_tsdiffana.1 # much more tightly controlled in a distribution package Patch: 0001-Downstream-only-allow-numpy-1.24.patch -BuildRequires: gcc -BuildRequires: flexiblas-devel BuildRequires: python3-devel - -BuildRequires: python3dist(setuptools) -# Imported in setup.py -BuildRequires: python3dist(numpy) +BuildRequires: gcc +BuildRequires: pkgconfig(flexiblas) # A weak dependency; may enable more tests BuildRequires: python3dist(matplotlib) %if %{with tests} BuildRequires: nipy-data -# An indirect dependency, via nibabel.testing (for nibabel 5.x) -BuildRequires: python3dist(pytest) -%endif - -%if %{with doc_pdf} -BuildRequires: graphviz -BuildRequires: latexmk -BuildRequires: make -BuildRequires: python3-ipython-sphinx -BuildRequires: python3-sphinx-latex -# Optional documentation dependency -BuildRequires: python3dist(vtk) %endif %global _docdir_fmt %{name} @@ -117,71 +86,40 @@ Requires: nipy-data %prep -%autosetup -n nipy-%{commit} -p1 - -# Add dependencies on libraries that are unbundled downstream to the metadata: -line="requirement_kwargs['install_requires'].extend(['transforms3d'])" -sed -r -i "s/^(def main|setup)/# Unbundled:\\n${line}\\n&/" setup.py - -# Some bundled pure-Python libraries have been replaced with dependencies: -# - python3dist(transforms3d) -# Begin by removing the subpackage for bundled dependencies: -rm -vrf nipy/externals/ -# Now fix the imports. The find-then-modify pattern keeps us from discarding -# mtimes on any sources that do not need modification. -find . -type f -exec gawk \ - '/(from|import) (\.+|nipy\.)externals/ { print FILENAME }' '{}' '+' | - xargs -r -t sed -r -i \ - -e 's/(from (nipy|\.*)\.externals )import/import/' \ - -e 's/from ((nipy|\.*)\.externals\.)([^ ]+) import/from \3 import/' -sed -r -i '/config\.add_subpackage\(.externals.\)/d' nipy/setup.py - -# Remove bundled lapack -rm -rf lib/lapack_lite/ - -# Remove pre-generated Cython C sources +%autosetup -n nipy-%{commit} + +# Remove bundled lapack_lite: +rm -rvf lib/lapack_lite/ +sed -r -i 's/^.*lapack_lite/# &/' lib/meson.build +sed -r -i 's/^#(external *= *)(False|0)/\1True/' setup.cfg + +# It looks like fff/fff_python_wrapper is a part of nipy rather than a bundled +# exgternal library. + +# https://docs.fedoraproject.org/en-US/packaging-guidelines/BLAS_LAPACK/ +sed -r -i 's/openblas/flexiblas/' nipy/labs/meson.build + +# Remove pre-generated Cython C sources (there should not be any): grep -FrlI 'Generated by Cython' . | xargs -r rm -vf -%py3_shebang_fix examples +%py3_shebang_fix nipy examples cp -p nipy/algorithms/statistics/models/LICENSE.txt scipy-LICENSE.txt -# Remove doc dependency version pins, which we cannot respect -sed -r -i -e 's/(,<.*)$//' -e 's/==/>=/' doc-requirements.txt -# We don’t have a python-nose3 package (a fork and drop-in replacement for the -# deprecated python-nose). See: -# https://fedoraproject.org/wiki/Changes/DeprecateNose -sed -r -i 's/\bnose3\b/nose/' setup.py dev-requirements.txt - -# Upstream pins a numpy version in order to build forward-compatible wheels for -# PyPI; we can’t respect the version pin, but we also don’t need it, as we only -# need to work with the packaged numpy version. -sed -r -i 's/(numpy)==/\1>=/' pyproject.toml +# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters +sed -r -e 's/^(pytest-cov|coverage|pre-commit)/# &/' dev-requirements.txt | + tee dev-requirements-filtered.txt %generate_buildrequires -%pyproject_buildrequires dev-requirements.txt %{?with_doc_pdf:doc-requirements.txt} +%pyproject_buildrequires -w %{?with_tests:dev-requirements-filtered.txt} %build -export NIPY_EXTERNAL_LAPACK=1 - -# Regenerate the Cython files -%make_build recythonize PYTHON='%{python3}' - %pyproject_wheel -%if %{with doc_pdf} -BLIB="${PWD}/build/lib.%{python3_platform}-cpython-%{python3_version_nodots}" -PYTHONPATH="${BLIB}" PYTHON='%{python3}' \ - %make_build -C doc latex SPHINXOPTS='%{?_smp_mflags}' -%make_build -C doc/dist/latex LATEXMKOPTS='-quiet' -%endif - %install -export NIPY_EXTERNAL_LAPACK=1 - %pyproject_install %pyproject_save_files nipy @@ -192,13 +130,10 @@ install -t '%{buildroot}%{_mandir}/man1' -m 0644 -p -D \ %check %pyproject_check_import -e '*.tests' -e '*.tests.*' -e '*.test' -e '*.test.*' %if %{with tests} +# See: .github/workflows/test.yml mkdir -p for_testing cd for_testing -PATH="%{buildroot}%{_bindir}:${PATH}" \ - PYTHONPATH='%{buildroot}%{python3_sitearch}' \ - PYTHONDONTWRITEBYTECODE=1 \ - %{python3} ../tools/nipnost --verbosity=3 \ - nipy %{?with_ignore_test_failure:|| :} +%pytest -v --doctest-plus --ignore-glob='__config__.py' --pyargs nipy %endif @@ -228,10 +163,6 @@ PATH="%{buildroot}%{_bindir}:${PATH}" \ %doc README.rst %doc THANKS -%if %{with doc_pdf} -%doc doc/dist/latex/nipy.pdf -%endif - %doc examples/ diff --git a/sources b/sources index 14028cd..e219d1e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nipy-961fa38508394a209f8964f6e6efc613972f6038.tar.gz) = d81ba0a600e8dde15c7b79be9208efe4cc6d60ca5a05a2f561a185ae7303e33ff832593f06707f543e703bcb1922b55edf5edd4580c70206c2ae41032de559a0 +SHA512 (nipy-e5e063b09d094ff79d2089261828fd2b2c843ab6.tar.gz) = 905bd80fda4154df0391daf4725d417288aa3856964df4beb533eee1bb1ecaac4c0d6a24362eb471e686e45a3d5cb79c6891f5bd81140e39f6a8bd3081903360