## START: Set by rpmautospec ## (rpmautospec version 0.6.0) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 1; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec # 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 # For now, we treat https://github.com/wtclarke/mrs_nifti_standard as a bundled # dependency. However, it’s not clear if it makes sense to try to unbundle it # or if (since what is bundled is merely a data file) it even makes sense to # consider it as a bundled dependency. The only part that might be used by # other packages is the machine-readable specification, definitions.json; this # is also the only part we need. %global std_version 0.9 Name: python-nifti-mrs Version: 1.2.0 Release: %autorelease Summary: Software tools for the NIfTI-MRS data format # The entire package is BSD-3-Clause: # - The generated %%{python3_sitelib}/nifti_mrs/_version.py in # python3-nifti-mrs is Unlicense because it is generated by Versioneer # (python-versioneer). # - Content from Source1 is CC-BY-4.0 (any code is BSD-3-Clause and is not # included in the binary distributions). Specifically, we distribute # definitions.json under CC-BY-4.0. License: BSD-3-Clause AND Unlicense AND CC-BY-4.0 URL: https://github.com/wtclarke/nifti_mrs_tools # The GitHub archive contains API documentation and a changelog file, which the # PyPI sdists lack. (On the other hand, if we switched to the PyPI sdists, we # would not need a second source for the standard specification.) Source0: %{url}/archive/%{version}/nifti_mrs_tools-%{version}.tar.gz %global std_url https://github.com/wtclarke/mrs_nifti_standard Source1: %{std_url}/archive/%{std_version}/mrs_nifti_standard-%{std_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 # The base package is arched due to endian-dependent test failures, but the # binary packages are noarch and contain no compiled code. %global debug_package %{nil} 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 standardized 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} License: BSD-3-Clause AND Unlicense BuildArch: noarch # See notes at the top of the spec file; this should perhaps not really be # considered a bundled dependency, but it is useful to annotate it. Provides: bundled(mrs_nifti_standard) = %{std_version} %description -n python3-nifti-mrs %{common_description} %package -n mrs_tools Summary: NIfTI-MRS (Magnetic Resonance Spectroscopy) tools # This subpackage contains neither _version.py (under Unlicense) nor content # from the standard specification, Source1, under CC-BY-4.0. License: BSD-3-Clause BuildArch: noarch 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 # This subpackage contains neither _version.py (under Unlicense) nor content # from the standard specification, Source1, under CC-BY-4.0. License: BSD-3-Clause BuildArch: noarch %description doc %{common_description} %endif %prep %autosetup -n nifti_mrs_tools-%{version} %setup -q -T -D -b 1 -n nifti_mrs_tools-%{version} # Upstream uses a git submodule. # # Normally, we would remove the empty directory and replace it with a symbolic # link, but instead we copy (only) the file that is actually needed. This # works around: # Unnecessary file nifti_mrs/standard/explanatory_doc/conf.py # https://github.com/wtclarke/nifti_mrs_tools/issues/24 # and corresponds roughly to: # Exclude contents of subdirectories of the standard submodule # https://github.com/wtclarke/nifti_mrs_tools/pull/25 ln ../mrs_nifti_standard-%{std_version}/definitions.json \ src/nifti_mrs/standard/ # We do also want to package a copy of the license text for the standard. ln -s ../mrs_nifti_standard-%{std_version}/LICENSE LICENSE-mrs_nifti_standard %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 -l nifti_mrs mrs_tools install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 \ '%{SOURCE10}' '%{SOURCE11}' '%{SOURCE12}' '%{SOURCE13}' '%{SOURCE14}' \ '%{SOURCE15}' '%{SOURCE16}' '%{SOURCE17}' %check %ifarch s390x # Tests fail when file endianness does not match host endianness # https://github.com/wtclarke/nifti_mrs_tools/issues/16 # Nevertheless, the software may still be useful on this architecture for # processing big-endian NIfTI files, so we skip the tests rather than adding # ExcludeArch. k="${k-}${k+ and }not test_nifti_mrs_save" k="${k-}${k+ and }not test_merge" k="${k-}${k+ and }not test_split" k="${k-}${k+ and }not test_reorder" k="${k-}${k+ and }not test_reshape" k="${k-}${k+ and }not test_conjugate" %endif %pytest -k "${k-}" -v %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 %{python3_sitelib}/mrs_tools/ %{_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 ## START: Generated by rpmautospec * Tue Apr 02 2024 Packit - 1.2.0-1 - [packit] 1.2.0 upstream release - Resolves: rhbz#2272551 - Stop using packit since we now have a secondary source * Wed Jan 31 2024 Benjamin A. Beasley - 1.1.1-1 - Initial package (close RHBZ#2250532) ## END: Generated by rpmautospec