# 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.
%bcond doc 1
Name: python-nifti-mrs
Version: 1.0.2
Release: %autorelease
Summary: Software tools for the NIfTI-MRS data format
License: BSD-3-Clause
URL: https://github.com/wtclarke/nifti_mrs_tools
# The GitHub archive contains API documentation and a changelog file, which the
# PyPI sdists lack.
Source: %{url}/archive/%{version}/nifti_mrs_tools-%{version}.tar.gz
# Man pages hand-written for Fedora in groff_man(7) format based on --help
Source10: mrs_tools.1
Source11: mrs_tools-conjugate.1
Source12: mrs_tools-info.1
Source13: mrs_tools-merge.1
Source14: mrs_tools-reorder.1
Source15: mrs_tools-reshape.1
Source16: mrs_tools-split.1
Source17: mrs_tools-vis.1
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: %{py3_dist pytest}
%if %{with doc}
BuildRequires: make
BuildRequires: python3-sphinx-latex
BuildRequires: latexmk
%endif
%global common_description %{expand:
This package contains python-based tools for representing, validating, and
manipulating the NIfTI-MRS format. NIfTI-MRS is a standardised format for
storing Magnetic Resonance Spectroscopy data.
These tools are used extensively in the spec2nii format conversion program and
the FSL-MRS analysis software. However, this library can also be used as a
stand-alone set of tools.
If you use these tools please cite: Clarke, WT, Bell, TK, Emir, UE, et al.
NIfTI-MRS: A standard data format for magnetic resonance spectroscopy. Magn
Reson Med. 2022; 88: 2358- 2370. doi:10.1002/mrm.29418}
%description %{common_description}
%package -n python3-nifti-mrs
Summary: %{summary}
%description -n python3-nifti-mrs %{common_description}
%package -n mrs_tools
Summary: NIfTI-MRS (Magnetic Resonance Spectroscopy) tools
Requires: python3-nifti-mrs = %{version}-%{release}
%py_provides python3-mrs-tools
%description -n mrs_tools %{common_description}
# We don’t generate a metapackage for the “VIS” extra because it requires
# fsl-mrs, which (1) is not packaged, (2) is not on PyPI, (3) is non-free
# (non-commercial use only).
%if %{with doc}
%package doc
Summary: Documentation for python-nifti-mrs
%description doc %{common_description}
%endif
%prep
%autosetup -n nifti_mrs_tools-%{version}
%generate_buildrequires
%pyproject_buildrequires
%build
%pyproject_wheel
%if %{with doc}
PYTHONPATH="${PWD}/src" %make_build -C apidoc latex \
SPHINXOPTS='-j%{?_smp_build_ncpus}'
%make_build -C apidoc/_build/latex LATEXMKOPTS='-quiet'
%endif
%install
%pyproject_install
%pyproject_save_files nifti_mrs mrs_tools
install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 \
'%{SOURCE10}' '%{SOURCE11}' '%{SOURCE12}' '%{SOURCE13}' '%{SOURCE14}' \
'%{SOURCE15}' '%{SOURCE16}' '%{SOURCE17}'
%check
%pytest
%files -n python3-nifti-mrs -f %{pyproject_files}
%if %{without doc}
%doc CHANGELOG.md
%doc README.md
%endif
%exclude %{python3_sitelib}/mrs_tools/
%files -n mrs_tools
%exclude %{python3_sitelib}/nifti_mrs/
%{_bindir}/mrs_tools
%{_mandir}/man1/mrs_tools*.1*
%if %{with doc}
%files doc
%license LICENSE
%doc CHANGELOG.md
%doc README.md
%doc apidoc/_build/latex/nifti-mrs.pdf
%endif
%changelog
%autochangelog