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

# TODO adjust once this is implemented:
# https://bugzilla.redhat.com/show_bug.cgi?id=1935266
%global modname  jaraco
%global projname %{modname}.stream
%global pkgname  %{modname}-stream
%global srcname  %{modname}_stream

%bcond_without tests
# Change the build backend in EPEL9 because `setuptools>=61.2`
# is needed for PEP621
%if 0%{?epel} == 9
%bcond_without hatch
%else
%bcond_with    hatch
%endif

Name:           python-%{pkgname}
Version:        3.0.4
Release:        %autorelease
Summary:        Routines for dealing with data streams

License:        MIT
URL:            https://github.com/jaraco/%{projname}
Source0:        %{pypi_source %{srcname}}

BuildArch:      noarch

BuildRequires:  python3-devel
%if %{with hatch}
BuildRequires:  tomcli
%endif

%global _description %{expand:
Routines for handling streaming data, including a set of generators for
loading gzip data on the fly.}

%description %_description

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

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

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

%if %{with hatch}
tomcli set pyproject.toml lists str "build-system.requires" "hatchling" "hatch-vcs"
tomcli set pyproject.toml str "build-system.build-backend" "hatchling.build"
tomcli set pyproject.toml str "tool.hatch.version.source" "vcs"
tomcli set pyproject.toml lists str "tool.hatch.build.targets.wheel.packages" %{modname}
%endif

%generate_buildrequires
%if %{with tests}
%pyproject_buildrequires -x test
%else
%pyproject_buildrequires
%endif

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files -l %{modname}

%check
%if %{with tests}
%pytest
%else
%pyproject_check_import -e jaraco.stream.test_gzip
%endif

%files -n python3-%{pkgname} -f %{pyproject_files}
%doc README.rst NEWS.rst

%changelog
## START: Generated by rpmautospec
* Sat Jan 11 2025 Ondrej Mosnáček <omosnacek@gmail.com> - 3.0.4-5
- Fix for EPEL9 by building using hatch instead of setuptools

* Sat Jan 11 2025 Ondrej Mosnáček <omosnacek@gmail.com> - 3.0.4-4
- Simplify handling the tests

* Sat Jan 11 2025 Ondrej Mosnáček <omosnacek@gmail.com> - 3.0.4-3
- Stop depending on python3-jaraco

* Sat Jan 11 2025 Ondrej Mosnáček <omosnacek@gmail.com> - 3.0.4-2
- Let Python macros include the license automatically

* Wed Aug 21 2024 Ondrej Mosnáček <omosnacek@gmail.com> - 3.0.4-1
- Update to version 3.0.4 (fedora#2307112)

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.3-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 3.0.3-9
- Rebuilt for Python 3.13

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

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

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

* Wed Jun 14 2023 Python Maint <python-maint@redhat.com> - 3.0.3-5
- Rebuilt for Python 3.12

* Wed Mar 15 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 3.0.3-4
- Adjust for EPEL9

* Tue Mar 14 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 3.0.3-3
- Add back the %%license line

* Tue Feb 21 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 3.0.3-2
- Apply minor suggestions from review

* Fri Feb 17 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 3.0.3-1
- Initial import (fedora#2164874)
## END: Generated by rpmautospec