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

Name:           python-hypercorn
Version:        0.17.3
Release:        %autorelease
Summary:        ASGI Server based on Hyper libraries and inspired by Gunicorn

# SPDX
License:        MIT
URL:            https://github.com/pgjones/hypercorn
# PyPI source distributions lack tests, changelog, etc.; use the GitHub archive
Source:         %{url}/archive/%{version}/hypercorn-%{version}.tar.gz

# Downstream-only: patch out coverage analysis
#
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
Patch:          0001-Downstream-only-patch-out-coverage-analysis.patch
# Remove unnecessary aioquic version limit
# https://github.com/pgjones/hypercorn/pull/267
Patch:          %{url}/pull/267.patch

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  help2man

%global common_description %{expand:
Hypercorn is an ASGI and WSGI web server based on the sans-io hyper, h11, h2,
and wsproto libraries and inspired by Gunicorn. Hypercorn supports HTTP/1,
HTTP/2, WebSockets (over HTTP/1 and HTTP/2), ASGI, and WSGI specifications.
Hypercorn can utilize asyncio, uvloop, or trio worker types.

Hypercorn can optionally serve the current draft of the HTTP/3 specification
using the aioquic library.}

%description %{common_description}


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

%description -n python3-hypercorn %{common_description}


%pyproject_extras_subpkg -n python3-hypercorn h3 trio uvloop


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


%generate_buildrequires
%pyproject_buildrequires -t -x h3,trio,uvloop


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files hypercorn

# We must wait until %%install to generate the man page so we can use the
# generated entry point that was installed in the buildroot.
install -d %{buildroot}%{_mandir}/man1
%{py3_test_envvars} help2man \
    --no-info \
    --version-string=%{version} \
    --output=%{buildroot}%{_mandir}/man1/hypercorn.1 \
    %{buildroot}%{_bindir}/hypercorn


%check
%tox -- -- -v -k "${k-}"


%files -n python3-hypercorn -f %{pyproject_files}
%license LICENSE
%doc CHANGELOG.rst
%doc README.rst

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


%changelog
## START: Generated by rpmautospec
* Tue Feb 11 2025 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.3-7
- Stop skipping test_startup_failure since we now have a recent trio

* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild

* Fri Nov 22 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.3-4
- Remove a patch for executable sources that was merged upstream

* Fri Nov 22 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.3-3
- Remove unnecessary aioquic version limit

* Fri Nov 22 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.3-2
- Skip test_startup_failure (our trio is too old)

* Sat Nov 16 2024 Packit <hello@packit.dev> - 0.17.3-1
- Update to 0.17.3 upstream release
- Resolves: rhbz#2283708

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

* Sun Jun 09 2024 Python Maint <python-maint@redhat.com> - 0.17.2-2
- Rebuilt for Python 3.13

* Tue May 28 2024 Packit <hello@packit.dev> - 0.17.2-1
- Update to 0.17.2 upstream release
- Resolves: rhbz#2283551

* Mon May 27 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.0-3
- Backport a couple of test fixes; fixes compat. with trio 0.25.x

* Sat Mar 30 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.0-2
- Enforce American English orthography in the description

* Mon Feb 05 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.0-1
- Initial package (close RHBZ#2262174)
## END: Generated by rpmautospec