## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 6;
    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

# The sole test does not seem to work
# https://github.com/Donders-Institute/multiecho/issues/16
#
# Upstream, not the original author, agrees that it appears to be a placeholder
# rather than a usable test.
%bcond tests 0

Name:           python-multiecho
Version:        0.29
Release:        %autorelease
Summary:        Combine multi-echoes from a multi-echo fMRI acquisition

License:        Apache-2.0 OR MIT
URL:            https://github.com/Donders-Institute/multiecho
Source:         %{url}/archive/%{version}/multiecho-%{version}.tar.gz

# Fix a typo in README.md (singl/single)
# https://github.com/Donders-Institute/multiecho/pull/20
Patch:          %{url}/pull/20.patch

BuildArch:      noarch

BuildRequires:  python3-devel

%if %{with tests}
# setup.py: tests_require
BuildRequires:  %{py3_dist pytest}
%endif

%global common_description %{expand:
MRI data acquisitions can involve multiple volumes acquired at different echo
times. Typically, subsequent processing pipelines assume data to be acquired at
a single echo time. This package provides a library and command-line tool to
combine multiple echoes from a multi-echo (BOLD f)MRI acquisition.}

%description %{common_description}


%package -n python3-multiecho
Summary:        %{summary}

%description -n python3-multiecho %{common_description}


%prep
%autosetup -n multiecho-%{version} -p1
# Remove the shebang from the multiecho.combination module; upstream seems to
# have intended it to be directly executable as a script when working on the
# source, but it will not be installed with the executable bit set, so the
# shebang is useless. When packaged, we have the entry point “mecombine”
# anyway.
sed -r -i '1{/^#!/d}' multiecho/combination.py


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files -l multiecho


%check
%pyproject_check_import
%if %{with tests}
%pytest
%endif


%files -n python3-multiecho -f %{pyproject_files}
%doc README.md

%{_bindir}/mecombine
%{_mandir}/man1/mecombine.1*


%changelog
## START: Generated by rpmautospec
* Sun Mar 31 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.29-6
- Fix a typo in README.md (singl/single)

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.29-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.29-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Dec 18 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.29-3
- Assert that %%pyproject_files contains a license file

* Fri Aug 25 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.29-1
- Update to 0.29 (close RHBZ#2234817)

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.28^20230704gitb4078f0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Wed Jul 05 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.28^20230704gitb4078f0-1
- Initial package (close RHBZ#2219161)
## END: Generated by rpmautospec