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

%bcond falcon 1

%global srcname openapi-core
%global modname openapi_core

Name:           python-%{srcname}
Version:        0.19.2
Release:        %autorelease
Summary:        OpenAPI client-side and server-side support

License:        BSD-3-Clause
URL:            https://github.com/python-openapi/%{srcname}
Source:         %{pypi_source %{modname}}

# Upstream now requires pytest 8, but it is not yet available in Fedora. All
# tests pass with the proposed pytest 8 in
# https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/. Until it ships,
# we must revert the changes for pytest 8:
Patch:          0001-Revert-Pytest-8-upgrade.patch

BuildArch:      noarch
BuildRequires:  python3-devel

# Test dependencies; see [tool.poetry.dev-dependencies], but note that this
# contains both test dependencies and unwanted linters etc., as well as some
# packages that are not directly required by the tests, such as webob and
# strict-rfc3339.
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(pytest-aiohttp)
BuildRequires:  python3dist(responses)

# This is not directly imported in the tests, but is implicitly required for
# some of the Django integration tests.
BuildRequires:  python3dist(djangorestframework)
# This is not directly imported in the tests, but is implicitly required for
# some of the FastAPI and Starlette integration tests.
BuildRequires:  python3dist(httpx)

%global _description %{expand:
Openapi-core is a Python library that adds client-side and server-side
support for the OpenAPI v3.0 and OpenAPI v3.1 specification.}

%description %_description


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

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


%pyproject_extras_subpkg -n python3-openapi-core aiohttp django %{?with_falcon:falcon} fastapi flask requests starlette


%prep
%autosetup -n %{modname}-%{version} -p1
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
sed -r -i '/^--cov[-=]/d' pyproject.toml
# We cannot respect a SemVer pin on FastAPI; it updates frequently, with
# usually-tiny breaking changes.
sed -r -i 's/(fastapi = \{version = ")\^/\1>=/' pyproject.toml


%generate_buildrequires

%pyproject_buildrequires -x aiohttp -x django %{?with_falcon:-x falcon} -x fastapi -x flask -x requests -x starlette


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files %{modname}


%check
%if %{without falcon}
ignore="${ignore-} --ignore=tests/integration/contrib/falcon"
%endif
%pytest ${ignore-}


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


%changelog
## START: Generated by rpmautospec
* Sun Jun 30 2024 Mattia Verga <mattia.verga@proton.me> - 0.19.2-1
- Update to 0.19.2 (fedora#2291451)
- Fix FTI with python 3.13 (fedora#2291807)

* Wed Jun 12 2024 Mattia Verga <mattia.verga@proton.me> - 0.19.1-4
- Rebuild for Python 3.13 (fixes Fedora#2291807)

* Mon Apr 22 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.19.1-3
- Patch for python-aiohttp 3.9.4 and later

* Thu Apr 11 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.19.1-2
- Patch for pytest 7; revert this when pytest 8 is packaged

* Thu Apr 11 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.19.1-1
- Update to 0.19.1 (close RHBZ#2274391)

* Wed Mar 06 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.19.0-5
- Allow newer FastAPI versions (close RHBZ#2268092)

* Fri Feb 16 2024 Mattia Verga <mattia.verga@proton.me> - 0.19.0-3
- Accept fastapi 0.109

* Fri Feb 16 2024 Mattia Verga <mattia.verga@proton.me> - 0.19.0-2
- Add fastapi extras

* Fri Feb 16 2024 Mattia Verga <mattia.verga@proton.me> - 0.19.0-1
- Final 0.19.0

* Fri Feb 09 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.19.0~a1-2
- Allow Starlette versions through 0.37.x

* Sat Jan 27 2024 Mattia Verga <mattia.verga@proton.me> - 0.19.0~a1-1
- Update to 0.19.0a1 (fedora#2251107)

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

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

* Fri Jan 12 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.18.2-3
- Allow starlette 0.35.1

* Wed Dec 27 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.18.2-2
- Patch to permit starlette 0.32.0

* Mon Nov 06 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.18.2-1
- Update to 0.18.2 (close RHBZ#2248158)

* Mon Oct 09 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.18.1-2
- Allow openapi-spec-validator 0.7.x

* Sat Sep 16 2023 Mattia Verga <mattia.verga@proton.me> - 0.18.1-1
- Update to 0.18.1 (fedora#2238939)

* Tue Sep 05 2023 Mattia Verga <mattia.verga@proton.me> - 0.18.0-1
- Update to 0.18.0

* Sat Jul 29 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.1-6
- Revert "Disable the “falcon” extra while python-falcon FTI"

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

* Sat Jul 15 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.1-4
- Rebuild for Python 3.12 (close RHBZ#2220374)

* Sat Jul 15 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.1-3
- Disable the “falcon” extra while python-falcon FTI

* Sat Jul 15 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.1-2
- Conditionalize the “falcon” extra

* Fri Mar 17 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.17.1-1
- Update to 0.17.1 (close RHBZ#2175776)
- Switch to the PyPI sdist since it now contains tests

* Thu Mar 02 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.6-2
- Update URL

* Thu Mar 02 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.6-1
- Update to 0.16.6 (close RHBZ#2164688)

* Fri Feb 03 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.5-2
- Fix tests with current openapi dependencies

* Wed Jan 25 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.5-1
- Update to 0.16.5 (close RHBZ#2162400)

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

* Mon Jan 16 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.4-5
- Add python3-openapi-core+falcon metapackage

* Mon Jan 16 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.4-4
- Switch to GitHub source and run the tests

* Mon Jan 16 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 0.16.4-3
- Allow openapi-schema-validator 0.4 (fix RHBZ#2160912)

* Thu Dec 22 2022 Mattia Verga <mattia.verga@proton.me> - 0.16.4-2
- Patch to avoid package dependency on modern python

* Wed Dec 21 2022 Mattia Verga <mattia.verga@proton.me> - 0.16.4-1
- Update to 0.16.4

* Wed Dec 21 2022 Mattia Verga <mattia.verga@proton.me> - 0.16.2-1
- Initial import (fedora#2154240)
## END: Generated by rpmautospec