diff --git a/.python-aiohttp-cors.metadata b/.python-aiohttp-cors.metadata new file mode 100644 index 0000000..dc099d2 --- /dev/null +++ b/.python-aiohttp-cors.metadata @@ -0,0 +1 @@ +90ab3216d518d1861c99dcc7d1022bd348bb302e SOURCES/python-aiohttp-cors-0.7.0.tar.gz diff --git a/SOURCES/1eb2226aaf664d0be746753a32f82ee2e04c2f0b.patch b/SOURCES/1eb2226aaf664d0be746753a32f82ee2e04c2f0b.patch new file mode 100644 index 0000000..2dd0df4 --- /dev/null +++ b/SOURCES/1eb2226aaf664d0be746753a32f82ee2e04c2f0b.patch @@ -0,0 +1,27 @@ +From 1eb2226aaf664d0be746753a32f82ee2e04c2f0b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= +Date: Tue, 1 Mar 2022 15:31:54 +0100 +Subject: [PATCH] Replace @asyncio.coroutine decorator with async def + +In Python 3.11 @asyncio.coroutine decorator was removed and it should +be replaced with async def call. + +Fixes: #280 +--- + tests/unit/test_cors_config.py | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/tests/unit/test_cors_config.py b/tests/unit/test_cors_config.py +index 817410e..9fe1052 100644 +--- a/tests/unit/test_cors_config.py ++++ b/tests/unit/test_cors_config.py +@@ -29,8 +29,7 @@ async def _handler(request): + + class _View(web.View, CorsViewMixin): + +- @asyncio.coroutine +- def get(self): ++ async def get(self): + return web.Response(text="Done") + + diff --git a/SOURCES/Remove-the-usage-of-pytest_cmdline_preparse-hook-rem.patch b/SOURCES/Remove-the-usage-of-pytest_cmdline_preparse-hook-rem.patch new file mode 100644 index 0000000..41b7639 --- /dev/null +++ b/SOURCES/Remove-the-usage-of-pytest_cmdline_preparse-hook-rem.patch @@ -0,0 +1,29 @@ +From c4b3826b0771772f8f190c74387636d311225cbf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= +Date: Tue, 23 Apr 2024 10:22:17 +0200 +Subject: [PATCH] Remove the usage of pytest_cmdline_preparse hook removed in + pytest 8 + +--- + conftest.py | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/conftest.py b/conftest.py +index 56d32b1..9e5488b 100644 +--- a/conftest.py ++++ b/conftest.py +@@ -5,11 +5,3 @@ if False: + import logging + logging.basicConfig(level=logging.DEBUG) + +- +-def pytest_cmdline_preparse(args): +- if sys.version_info[:2] == (3, 5): +- # Disable pylint on Python 3.5, since it's broken: +- # +- args[:] = ( +- ["-p", "no:pylint"] + +- [arg for arg in args if "pylint" not in arg]) +-- +2.44.0 + diff --git a/SOURCES/e64b95848f3253157d831f4934841fceeaf9b2e3.patch b/SOURCES/e64b95848f3253157d831f4934841fceeaf9b2e3.patch new file mode 100644 index 0000000..6c74bb6 --- /dev/null +++ b/SOURCES/e64b95848f3253157d831f4934841fceeaf9b2e3.patch @@ -0,0 +1,23 @@ +From e64b95848f3253157d831f4934841fceeaf9b2e3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Thu, 14 Nov 2019 12:54:47 +0100 +Subject: [PATCH] Test instance type by isinstance, not issubclass + +Fixes https://github.com/aio-libs/aiohttp-cors/issues/277 +--- + tests/unit/test_cors_config.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/unit/test_cors_config.py b/tests/unit/test_cors_config.py +index 817410e..d494e20 100644 +--- a/tests/unit/test_cors_config.py ++++ b/tests/unit/test_cors_config.py +@@ -103,7 +103,7 @@ def test_static_resource(app, cors): + "/file", "/", name="dynamic_named_route") + assert len(app.router.keys()) == 1 + for resource in list(app.router.resources()): +- if issubclass(resource, web.StaticResource): ++ if isinstance(resource, web.StaticResource): + cors.add(resource) + assert len(app.router.keys()) == 1 + diff --git a/SOURCES/eb4f5a4bb28f8260d4edc32969e838d9abace051.patch b/SOURCES/eb4f5a4bb28f8260d4edc32969e838d9abace051.patch new file mode 100644 index 0000000..504f21d --- /dev/null +++ b/SOURCES/eb4f5a4bb28f8260d4edc32969e838d9abace051.patch @@ -0,0 +1,63 @@ +From eb4f5a4bb28f8260d4edc32969e838d9abace051 Mon Sep 17 00:00:00 2001 +From: Andrew Svetlov +Date: Mon, 15 Oct 2018 21:32:48 +0300 +Subject: [PATCH] Fix tests + +--- + tests/integration/test_real_browser.py | 18 ++++++++---------- + tests/unit/test_cors_config.py | 5 ++--- + 2 files changed, 10 insertions(+), 13 deletions(-) + +diff --git a/tests/integration/test_real_browser.py b/tests/integration/test_real_browser.py +index a5c9030..5dff79a 100644 +--- a/tests/integration/test_real_browser.py ++++ b/tests/integration/test_real_browser.py +@@ -193,22 +193,20 @@ class ResourceView(web.View, CorsViewMixin): + + # Start servers. + for server_name, server_descr in self.servers.items(): +- handler = server_descr.app.make_handler() +- server = await self.loop.create_server( +- handler, +- sock=server_sockets[server_name]) +- server_descr.handler = handler +- server_descr.server = server ++ runner = web.AppRunner(server_descr.app) ++ await runner.setup() ++ site = web.SockSite(runner, server_sockets[server_name]) ++ await site.start() ++ server_descr.runner = runner + + self._logger.info("Started server '%s' at '%s'", + server_name, server_descr.url) + + async def stop_servers(self): + for server_descr in self.servers.values(): +- server_descr.server.close() +- await server_descr.handler.shutdown() +- await server_descr.server.wait_closed() +- await server_descr.app.cleanup() ++ runner = server_descr.runner ++ await runner.shutdown() ++ await runner.cleanup() + + self.servers = {} + +diff --git a/tests/unit/test_cors_config.py b/tests/unit/test_cors_config.py +index 5b8d8f3..817410e 100644 +--- a/tests/unit/test_cors_config.py ++++ b/tests/unit/test_cors_config.py +@@ -58,11 +58,10 @@ def options_route(app): + "OPTIONS", "/options_path", _handler) + + +-def test_add_options_route(cors, options_route): ++def test_add_options_route(app, cors, options_route): + """Test configuring OPTIONS route""" +- + with pytest.raises(ValueError, +- match="/options_path already has OPTIONS handler"): ++ match="already has OPTIONS handler"): + cors.add(options_route.resource) + + diff --git a/SPECS/python-aiohttp-cors.spec b/SPECS/python-aiohttp-cors.spec new file mode 100644 index 0000000..c4011a6 --- /dev/null +++ b/SPECS/python-aiohttp-cors.spec @@ -0,0 +1,187 @@ +%global srcname aiohttp-cors +%global common_desc aiohttp_cors library implements Cross Origin Resource Sharing (CORS) support \ +for aiohttp asyncio-powered asynchronous HTTP server. + +Name: python-%{srcname} +Version: 0.7.0 +Release: 26%{?dist} +Summary: CORS (Cross Origin Resource Sharing) support for aiohttp + +# Automatically converted from old format: ASL 2.0 - review is highly recommended. +License: Apache-2.0 +URL: https://github.com/aio-libs/aiohttp-cors +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +# Fix test failure of test_add_options_route +Patch1: %{url}/commit/eb4f5a4bb28f8260d4edc32969e838d9abace051.patch + +# Fix test failure of test_static_resource +Patch2: %{url}/pull/278/commits/e64b95848f3253157d831f4934841fceeaf9b2e3.patch + +# Python 3.11 compatibility +# Replace @asyncio.coroutine decorator with async def +Patch3: %{url}/pull/412/commits/1eb2226aaf664d0be746753a32f82ee2e04c2f0b.patch + +# pytest 8 compatibility +# We don't care about python 3.5 in Fedora, hence just removing +# the problematic function +Patch4: Remove-the-usage-of-pytest_cmdline_preparse-hook-rem.patch + +BuildArch: noarch + +%description +%{common_desc} + + +%package -n python3-%{srcname} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{srcname}} +BuildRequires: python3-devel +BuildRequires: python3-setuptools + +# For tes suite +BuildRequires: python3-pytest +BuildRequires: python3-pytest-aiohttp +BuildRequires: python3-aiohttp >= 1.1 + +# Browser tests not possible yet +# BuildRequires: python3-selenium +# +# ifarch on noarch? +# BuildRequires: chromium +# BuildRequires: chromedriver +# Chrome failed to start: exited abnormally +# (unknown error: DevToolsActivePort file doesn't exist) +# +# BuildRequires: firefox +# BuildRequires: geckodriver -- not available + +%description -n python3-%{srcname} +%{common_desc} + + +%prep +%autosetup -n %{srcname}-%{version} -p1 + +# remove non-essential pytest plugins +sed -i '/pytest-cov/d' setup.py +sed -i '/pytest-pylint/d' setup.py + +# Don't treat warnings as errors, that's what upstream testing is for +# In 0.7.0, nothing else is in this config +rm pytest.ini + +# Don't add --cov options to pytest +# In 0.7.0, nothing else is in this config +rm setup.cfg +# tox.ini has this repeated, but we don't need it +rm tox.ini + +%build +%py3_build + +%install +%py3_install + +%check +%{python3} -m pytest -v --ignore tests/integration/test_real_browser.py + +%files -n python3-%{srcname} +%license LICENSE +%doc README.rst CHANGES.rst +%{python3_sitelib}/aiohttp_cors +%{python3_sitelib}/aiohttp_cors-*.egg-info/ + +%changelog +* Sat Jan 18 2025 Fedora Release Engineering - 0.7.0-26 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Wed Jul 24 2024 Miroslav Suchý - 0.7.0-25 +- convert license to SPDX + +* Fri Jul 19 2024 Fedora Release Engineering - 0.7.0-24 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jun 07 2024 Python Maint - 0.7.0-23 +- Rebuilt for Python 3.13 + +* Fri Jan 26 2024 Fedora Release Engineering - 0.7.0-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 0.7.0-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jul 21 2023 Fedora Release Engineering - 0.7.0-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Thu Jun 29 2023 Python Maint - 0.7.0-19 +- Rebuilt for Python 3.12 + +* Fri Jan 20 2023 Fedora Release Engineering - 0.7.0-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Fri Jul 22 2022 Fedora Release Engineering - 0.7.0-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Tue Jun 14 2022 Python Maint - 0.7.0-16 +- Rebuilt for Python 3.11 + +* Fri Jan 21 2022 Fedora Release Engineering - 0.7.0-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 0.7.0-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 0.7.0-13 +- Rebuilt for Python 3.10 + +* Wed Jan 27 2021 Fedora Release Engineering - 0.7.0-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 0.7.0-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 0.7.0-10 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 0.7.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Nov 14 2019 Miro Hrončok - 0.7.0-8 +- Run the tests + +* Thu Oct 03 2019 Miro Hrončok - 0.7.0-7 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 0.7.0-6 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 0.7.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 0.7.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 0.7.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 0.7.0-2 +- Rebuilt for Python 3.7 + +* Sun Apr 22 2018 Athmane Madjoudj - 0.7.0-1 +- Update to 0.7.0 (rhbz #1554157) + +* Fri Feb 09 2018 Fedora Release Engineering - 0.6.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Dec 30 2017 Athmane Madjoudj - 0.6.0-1 +- Update to 0.6.0 (rhbz #1528479) + +* Thu Jul 27 2017 Fedora Release Engineering - 0.5.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Apr 29 2017 Athmane Madjoudj - 0.5.3-1 +- Update to 0.5.3 + +* Fri Feb 10 2017 Athmane Madjoudj - 0.5.0-1 +- Initial spec.