## START: Set by rpmautospec
## (rpmautospec version 0.2.6)
%define autorelease(e:s:pb:) %{?-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*}}%{?dist}
## END: Set by rpmautospec

Name:           python-starlette
Version:        0.22.0
Release:        %autorelease
Summary:        The little ASGI library that shines

# The entire source is BSD-3-Clause, with the possible exception of the
# pre-compiled/minified JavaScript for the Gitter chat app for the
# documentation, which is removed in %%prep anyway.
License:        BSD-3-Clause
URL:            https://www.starlette.io/
Source0:        https://github.com/encode/starlette/archive/%{version}/starlette-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python3-devel

Obsoletes:      python-starlette-doc < 0.16.0-10

%global common_description %{expand:
Starlette is a lightweight ASGI framework/toolkit, which is ideal for building
async web services in Python.

It is production-ready, and gives you the following:

  • A lightweight, low-complexity HTTP web framework.
  • WebSocket support.
  • In-process background tasks.
  • Startup and shutdown events.
  • Test client built on requests.
  • CORS, GZip, Static Files, Streaming responses.
  • Session and Cookie support.
  • 100%% test coverage.
  • 100%% type annotated codebase.
  • Few hard dependencies.
  • Compatible with asyncio and trio backends.
  • Great overall performance against independant benchmarks.}

%description %{common_description}


%pyproject_extras_subpkg -n python3-starlette full


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

%description -n python3-starlette %{common_description}


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

# Remove Gitter chat app from documentation; it relies on pre-compiled/minified
# JavaScript, which is not acceptable in Fedora. Since we are not building
# documentation, we do this very bluntly:
rm -vrf docs/js

# Produce a filtered version of requirements.txt, which contains testing
# dependencies.
awk '
!NF { next }
$1 == "#" {
  # We do not need the “Optionals”, which correspond to the “full” extra we are
  # already BR’ing; those for “Packaging”, which are for uploading to PyPI; or
  # those for “Documentation”, so long as we are not able to build and package
  # it; but we do need those for “Testing”, except linters, formatters,
  # coverage analysis, and mypy-related dependencies.
  o = $2 !~ /^(Optionals|Documentation|Packaging)$/
  next
}
o {
  # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
  if ($1 ~ /^(black|coverage|(auto)?flake8?|isort|mypy|types-)/) { next }
  # Drop version pins
  sub(/[>=]=.*$/, "", $0)
  print $0
}
' requirements.txt | tee requirements-filtered.txt


%generate_buildrequires
%pyproject_buildrequires -x full requirements-filtered.txt


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files starlette


%check
# There are new trio.TrioDeprecationWarnings from trio 0.22.0, which would be
# treated as errors; Starlette upstream pins trio 0.21.0 for their CI. We trust
# upstream will encounter and deal with this by the time the deprecated
# functionality is removed.
#
#   E       trio.TrioDeprecationWarning: trio.MultiError is deprecated since
#           Trio 0.22.0; use BaseExceptionGroup (on Python 3.11 and later) or
#           exceptiongroup.BaseExceptionGroup (earlier versions) instead
#           (https://github.com/python-trio/trio/issues/2211)
%pytest -W 'ignore::trio.TrioDeprecationWarning'


%files -n python3-starlette -f %{pyproject_files}
%doc README.md


%changelog
* Thu Nov 17 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.22.0-1
- Update to 0.22.0 (close RHBZ#2143717)

* Wed Oct 19 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.21.0-1
- Update to 0.21.0 (close RHBZ#2130415)

* Wed Oct 19 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.20.4-2
- Update License to SPDX

* Thu Jul 28 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.20.4-1
- Update to 0.20.4 (close RHBZ#2101930)

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

* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> 0.20.3-2
- Rebuilt for Python 3.11

* Fri Jun 10 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.20.3-1
- Update to 0.20.3 (close RHBZ#2095819)

* Wed Jun 08 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.20.2-1
- Update to 0.20.2 (close RHBZ#2094719)

* Sun May 29 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.20.1-1
- Update to 0.20.1 (close RHBZ#2091358)

* Wed May 04 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.20.0-1
- Update to 0.20.0 (close RHBZ#2081683)

* Sun Apr 24 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.19.1-1
- Update to 0.19.1 (close RHBZ#2077753)

* Sun Apr 24 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.19.0-2
- Stop allowing older pytest (F37+)

* Thu Mar 10 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.19.0-1
- Update to 0.19.0 (close RHBZ#2062498)

* Wed Feb 02 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.18.0-1
- Update to 0.18.0 (close RHBZ#2044099)

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

* Fri Nov 19 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.17.1-1
- Update to 0.17.1 (close RHBZ#2024510)

* Sat Nov 06 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.17.0-1
- Update to 0.17.0 (close RHBZ#2020563)

* Tue Oct 19 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-11
- Drop flake8 BR

* Wed Sep 29 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-10
- Drop the documentation subpackage entirely.

* Mon Sep 13 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-9
- No need to remove egg-info with pyproject-rpm-macros

* Mon Sep 13 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-8
- Escape percents in description

* Mon Sep 13 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-7
- Drop BR on pyproject-rpm-macros, now implied by python3-devel

* Mon Sep 13 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-6
- Reduce macro indirection in the spec file

* Mon Sep 13 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-5
- Remove F33 accommodations from Rawhide spec

* Mon Sep 13 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-4
- Let pyproject-rpm-macros handle the license file

* Wed Aug 11 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-3
- Update to note orphan status of mkdocs

* Tue Jul 27 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-2
- Move %%generate_buildrequires after %%prep to make the spec file easier
  to follow

* Wed Jul 21 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.16.0-1
- Update to 0.16.0 (closes RHBZ#1983794)

* Thu Jun 24 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.15.0-1
- Update to 0.15.0 (closes RHBZ#1975613)

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

* Fri May 28 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.14.2-7
- Build documentation without mkdocs-material; this has no effect as long as
  mkautodoc is not available

* Fri May 14 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.14.2-6
- Add databases[sqlite] BR for testing where available (F34+)

* Tue Mar 16 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.14.2-5
- Drop python3dist(setuptools) BR, redundant with %%pyproject_buildrequires

* Mon Mar 01 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.14.2-4
- Move documentation BR’s to base package

* Fri Feb 26 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.14.2-3
- Drop mypy BR

* Thu Feb 25 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.14.2-2
- Use srcname macro instead of pypi_name
- Drop obsolete python_provide macro
- Implement the “full” extra metapackage, dropping the corresponding
  dependencies from the main package
- Use pyproject-rpm-macros, including generated BR’s
- Improved description from upstream

* Wed Feb 03 2021 Filipe Rosset <rosset.filipe@gmail.com> - 0.14.2-1
- Update to 0.14.2 fixes FTBFS rhbz#1908274

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

* Wed Sep 30 2020 Itamar Reis Peixoto <itamar@ispbrasil.com.br> - 0.13.8-1
- Initial package.
- Switch to github sources and enable some tests