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

# Build doc by default
%bcond_without doc

# mailman3's TestableMaster can't be used outside of a
# source checkout?
%bcond_with tests

%global srcname hyperkitty
%global pypi_name HyperKitty

Name:           python-%{srcname}
Version:        1.3.7
Release:        %autorelease
Summary:        A web interface to access GNU Mailman v3 archives
License:        GPL-3.0-or-later
URL:            https://gitlab.com/mailman/hyperkitty
Source0:        %{pypi_source %{pypi_name}}
# don't check out modules from git
Patch0:         %{pypi_name}-tox-localdeps.patch
# based on https://gitlab.com/mailman/hyperkitty/-/commit/9f5aa18689e66d6c7cdb57263932a72258dc243f
Patch1:         %{pypi_name}-django42-compat.patch

BuildArch:      noarch

BuildRequires:  python%{python3_pkgversion}-devel

%if %{with doc}
BuildRequires:  make
BuildRequires:  python%{python3_pkgversion}-sphinx
%endif

%global _description %{expand:
HyperKitty is an open source Django application under development. It aims to
provide a web interface to access GNU Mailman v3 archives.}

%description %{_description}


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

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


%package -n %{srcname}-doc
Summary:        Documentation for %{srcname}
Suggests:       %{srcname} = %{version}-%{release}

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

This package contains the documentation for %{srcname}.


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


%generate_buildrequires
%if %{with tests}
%pyproject_buildrequires -t
%else
%pyproject_buildrequires
%endif


%build
%pyproject_wheel

%if %{with doc}
(cd doc && PYTHONPATH=..:${PYTHONPATH} make html)
%endif


%install
%pyproject_install
%pyproject_save_files %{srcname}


%check
# requires the Django app to be configured
# pyproject_check_import
%if %{with tests}

PYTHONPATH=$(pwd)/src:${PYTHONPATH} \
%tox
%endif


%files -n %{srcname} -f %{pyproject_files}
%license COPYING.txt
%doc AUTHORS.txt README.rst

%if %{with doc}
%files -n %{srcname}-doc
%license COPYING.txt
%doc doc/_build/html/*
%endif


%changelog
## START: Generated by rpmautospec
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.7-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

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

* Mon Jul 31 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.3.7-3
- Mark as compatible with Django 4.2 (rhbz#2226208, rhbz#2220273)

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

* Wed Mar 08 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.3.7-1
- Update to 1.3.7
- Use SPDX for license

* Fri Mar 03 2023 Tomas Hrcka <thrcka@redhat.com> - 1.3.5-5
- Unretirement request: https://pagure.io/releng/issue/11314

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

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

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

* Tue Dec 14 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.3.5-1
- Initial Fedora package
## END: Generated by rpmautospec