## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%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

%global srcname ducc0

Name:           python-%{srcname}
Version:        0.27.0
Release:        %autorelease
Summary:        Programming tools for numerical computation

License:        GPLv2+ and BSD
URL:            https://pypi.python.org/pypi/%{srcname}
Source0:        %{pypi_source}

# Fix pyproject.toml warnings
Patch:          ducc0-0.24_pyproject.patch

ExcludeArch:    %{ix86}
# Tests started to fail from 0.25
# Waiting for upstream to look at that, meanwhile stick to 0.24 on these arches
# https://github.com/mreineck/ducc/issues/3
# Fedora#2138554
ExcludeArch:    aarch64 s390x

BuildRequires:  gcc-c++
BuildRequires:  python3-devel
BuildRequires:  python3dist(pytest)

%global _description %{expand:
This is a collection of basic programming tools for numerical computation,
including Fast Fourier Transforms, Spherical Harmonic Transforms,
non-equispaced Fourier transforms, as well as some concrete applications
like 4pi convolution on the sphere and gridding/degridding of radio
interferometry data.
The code is written in C++17, but provides a simple and comprehensive
Python interface.}

%description %_description


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

# Importable module is named ducc
%py_provides python3-ducc

%description -n python3-%{srcname} %_description


%prep
%autosetup -p1 -n %{srcname}-%{version}

# there's no other way to disable ducc to inject custom C flags
sed -i 's|extra_compile_args=extra_compile_args|extra_compile_args=\[\]|g' setup.py
sed -i 's|extra_link_args=python_module_link_args|extra_link_args=\[\]|g' setup.py

%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files ducc0


%check
%pyproject_check_import
%pytest -q python/test


%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE
%doc README.md


%changelog
* Sat Oct 29 2022 Mattia Verga <mattia.verga@proton.me> 0.27.0-1
- Update to 0.27.0 (fedora#2138366)

* Sat Oct 01 2022 Mattia Verga <mattia.verga@proton.me> 0.26.0-2
- Do not update on s390x and aarch64 until tests pass again

* Sat Oct 01 2022 Mattia Verga <mattia.verga@proton.me> 0.26.0-1
- Update to 0.26.0 (fedora#2117652)

* Sat Aug 13 2022 Mattia Verga <mattia.verga@proton.me> 0.25.0-1
- Update to 0.25.0 (fedora#2117652)
- Exclude build on ix86 arches

* Mon Aug 08 2022 Mattia Verga <mattia.verga@proton.me> 0.24.0-5
- Temporarily disable tests on i686

* Thu Aug 04 2022 Mattia Verga <mattia.verga@proton.me> 0.24.0-4
- Fix build failure (fedora#2113621)

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> 0.24.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Sun Jun 26 2022 Mattia Verga <mattia.verga@proton.me> 0.24.0-2
- Enable pytest tests

* Sun Jun 26 2022 Mattia Verga <mattia.verga@proton.me> 0.24.0-1
- Upgrade to 0.24.0 (fedora#2100047)

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> 0.23.0-2
- Rebuilt for Python 3.11

* Tue Apr 12 2022 Mattia Verga <mattia.verga@protonmail.com> 0.23.0-1
- Update to 0.23.0 (fedora#2074206)

* Tue Apr 05 2022 Mattia Verga <mattia.verga@protonmail.com> 0.22.1-1
- Bugfix release 0.22.1

* Wed Feb 02 2022 Mattia Verga <mattia.verga@protonmail.com> 0.22.0-1
- Initial import (fedora#2048258)