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

Name:           python-%{pypi_name}
Version:        0.3.6
Release:        %autorelease
Summary:        Collects BOUT++ data from parallelized simulations into xarray

License:        apache-2.0
URL:            https://github.com/boutproject/xBOUT
Source0:        https://github.com/boutproject/xBOUT/archive/refs/tags/%{version}.tar.gz#./xbout2-%{version}.tar.gz
#Source0:        %%{pypi_source}
BuildArch:      noarch

Patch:          https://github.com/boutproject/xBOUT/pull/280.patch#./polygon-plotting.patch
Patch:          https://github.com/boutproject/xBOUT/pull/303.patch#./xarray-update.patch
Patch:          sphinx-theme.patch
Patch:          fix-dirs.patch


# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch: %{ix86}

BuildRequires:  python3-devel
# extra debug
BuildRequires:  valgrind
BuildRequires:  python3-netcdf4-debuginfo
BuildRequires:  netcdf4-python-debugsource
# Sphinx for docs
BuildRequires:  python3dist(sphinx)
BuildRequires:  python3-boutdata
BuildRequires:  python3-sphinx-autodoc-typehints
# Testing
BuildRequires:  python3dist(pytest)

%generate_buildrequires
%pyproject_buildrequires -r

%description
xBOUT provides an interface for collecting the output data from a
BOUT++ simulation into an xarray dataset in an efficient and
scalable way, as well as accessor methods for common BOUT++ analysis
and plotting tasks.


%package -n     python3-%{pypi_name}
Summary:        %{summary}
%py_provides python3-%{pypi_name}}

Requires:  python3-boutdata

%description -n python3-%{pypi_name}
xBOUT provides an interface for collecting the output data from a
BOUT++ simulation into an xarray dataset in an efficient and
scalable way, as well as accessor methods for common BOUT++ analysis
and plotting tasks.

%package -n python3-%{pypi_name}-doc
Summary:        xBOUT documentation
Recommends:     python3-%{pypi_name}
%description -n python3-%{pypi_name}-doc
Documentation for xBOUT

%prep
%autosetup -n xBOUT-%{version} -p 1
# Remove bundled egg-info
rm -rf xbout.egg-info

%build
%pyproject_wheel
# generate html docs 
PYTHONPATH=${PWD} sphinx-build-3 docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%install
%pyproject_install
%pyproject_save_files %{pypi_name}

%check
#%%pytest xbout --long --durations=0
valgrind -v python3 /usr/bin/pytest --durations=0


%files -n python3-%{pypi_name}
%license LICENSE
%doc README.md
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/xbout-%{version}.dist-info

%files -n python3-%{pypi_name}-doc
%doc html
%license LICENSE

%changelog
## START: Generated by rpmautospec
* Wed Nov 06 2024 David Bold <dave@ipp.mpg.de> - 0.3.6-4
- Uncommitted changes

* Tue Jun 18 2024 Python Maint <python-maint@redhat.com> - 0.3.6-3
- Rebuilt for Python 3.13

* Fri Apr 05 2024 David Bold <davidsch@fedoraproject.org> - 0.3.6-2
- Convert license to SPDX

* Fri Apr 05 2024 David Bold <davidsch@fedoraproject.org> - 0.3.6-1
- Update to 0.3.6

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

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

* Tue Jul 25 2023 David Bold <dave@ipp.mpg.de> - 0.3.5-8
- Animatplot has been updated

* Mon Jul 24 2023 David Bold <davidsch@fedoraproject.org> - 0.3.5-7
- fix whitespace in patch

* Mon Jul 24 2023 David Bold <dave@ipp.mpg.de> - 0.3.5-6
- Switch to animatplot-ng

* Sun Jul 23 2023 Python Maint <python-maint@redhat.com> - 0.3.5-5
- Rebuilt for Python 3.12

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Mon Mar 27 2023 David Bold <davidsch@fedoraproject.org> - 0.3.5-3
- Fix whitespace in patch

* Fri Mar 24 2023 David Bold <davidsch@fedoraproject.org> - 0.3.5-2
- Remove restriction on xarray version

* Thu Mar 23 2023 David Bold <davidsch@fedoraproject.org> - 0.3.5-1
- Update to 0.3.5

* Sun Jan 22 2023 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.3.4-3
- Drop support for i686

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Mon Jan 09 2023 David Bold <davidsch@fedoraproject.org> - 0.3.4-1
- Update to 0.3.4

* Thu Aug 25 2022 David Bold <davidsch@fedoraproject.org> - 0.3.3-1
- Update to 0.3.3

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

* Tue Jun 21 2022 David Bold <davidsch@fedoraproject.org> - 0.3.1-3
- Rebuild for python3.11

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Sep 23 2021 David Bold <davidsch@fedoraproject.org> - 0.3.1-1
- Update to 0.3.1

* Sun Aug 22 2021 David Bold <davidsch@fedoraproject.org> - 0.2.5-1
- Update to 0.2.5

* Tue Jul 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-3
- Second attempt - Rebuilt for
  https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.2.4-2
- Rebuilt for Python 3.10

* Sat Apr 17 2021 David Schwörer <davidsch@fedoraproject.org> - 0.2.4-1
- Update to 0.2.4

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sun Dec 06 2020 David Schwörer <davidsch@fedoraproject.org> - 0.2.3-0.2
- Fix FTI
- Fix License

* Sun Dec 06 2020 David Schwörer <davidsch@fedoraproject.org> - 0.2.3-0.1
- Initial package.

## END: Generated by rpmautospec