Sync from SUSE:SLFO:Main python-aiohttp_cors revision 7fef3b61e9264dca45fc778ffb815ef5

This commit is contained in:
Adrian Schröter 2024-05-03 20:02:10 +02:00
commit e7a891cc12
8 changed files with 307 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,26 @@
From 89e66325b9dbad03554a649c42c46e752c4a7d5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diogo=20Magalh=C3=A3es=20Martins?=
<magalhaesmartins@icloud.com>
Date: Fri, 14 Jun 2019 08:27:37 -0300
Subject: [PATCH] #215 - fixing exception message (#216)
---
aiohttp_cors/urldispatcher_router_adapter.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aiohttp_cors/urldispatcher_router_adapter.py b/aiohttp_cors/urldispatcher_router_adapter.py
index 1a65e99..f2b02ab 100644
--- a/aiohttp_cors/urldispatcher_router_adapter.py
+++ b/aiohttp_cors/urldispatcher_router_adapter.py
@@ -97,7 +97,7 @@ def _is_web_view(entity, strict=True):
if not issubclass(handler, CorsViewMixin):
if strict:
raise ValueError("web view should be derived from "
- "aiohttp_cors.WebViewMixig for working "
+ "aiohttp_cors.CorsViewMixin for working "
"with the library")
else:
return False
--
2.26.2

66
0001-Fix-tests.patch Normal file
View File

@ -0,0 +1,66 @@
From eb4f5a4bb28f8260d4edc32969e838d9abace051 Mon Sep 17 00:00:00 2001
From: Andrew Svetlov <andrew.svetlov@gmail.com>
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 IntegrationServers:
# 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)
--
2.26.2

23
278.patch Normal file
View File

@ -0,0 +1,23 @@
From e64b95848f3253157d831f4934841fceeaf9b2e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
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

27
412.patch Normal file
View File

@ -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?= <thrnciar@redhat.com>
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")

BIN
aiohttp-cors-0.7.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,47 @@
-------------------------------------------------------------------
Fri Apr 21 12:21:42 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 13 22:39:51 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Tue Jan 24 16:49:45 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Add 412.patch to support python 3.11 gh#aio-libs/aiohttp-cors#412
-------------------------------------------------------------------
Thu Aug 18 15:28:57 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Clean specfile, remove coverage
-------------------------------------------------------------------
Wed Dec 15 08:04:25 UTC 2021 - pgajdos@suse.com
- pytest-runner is not required for build
-------------------------------------------------------------------
Tue Jun 2 18:57:09 UTC 2020 - Martin Hauke <mardnh@gmx.de>
- Add URL tag
- Package LICENSE and README
- Rename specfiles and changes files to match the package name
* python-aiohttp-cors -> python-aiohttp_cors
- Add patches to fix the unit tests:
* 0001-Fix-tests.patch
* 0001-215-fixing-exception-message-216.patch
* 278.patch (gh#278)
-------------------------------------------------------------------
Mon Apr 2 07:14:38 UTC 2018 - adrian@suse.de
- update to version 0.7.0
-------------------------------------------------------------------
Sun Dec 31 09:16:55 UTC 2017 - adrian@suse.de
- package version 0.6.0

92
python-aiohttp_cors.spec Normal file
View File

@ -0,0 +1,92 @@
#
# spec file for package python-aiohttp_cors
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-aiohttp_cors
Version: 0.7.0
Release: 0
Summary: Asynchronous HTTP client/server framework
License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/aio-libs/aiohttp-cors
Source: https://files.pythonhosted.org/packages/source/a/aiohttp-cors/aiohttp-cors-%{version}.tar.gz
Patch0: 0001-Fix-tests.patch
Patch1: 0001-215-fixing-exception-message-216.patch
Patch2: 278.patch
# PATCH-FIX-UPSTREAM 412.patch gh#aio-libs/aiohttp-cors#412
Patch3: 412.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python >= 3.4.2
Requires: python-async_timeout >= 2.0.0
Requires: python-chardet
Requires: python-multidict >= 3.3.0
Requires: python-yarl >= 0.13.0
Recommends: python-aiodns
Recommends: python-cChardet
Suggests: %{name}-doc
# SECTION test requirements
BuildRequires: %{python_module aiohttp >= 1.1}
BuildRequires: %{python_module async_timeout >= 2.0.0}
BuildRequires: %{python_module chardet}
BuildRequires: %{python_module gunicorn}
BuildRequires: %{python_module multidict >= 3.3.0}
BuildRequires: %{python_module pytest-mock}
BuildRequires: %{python_module pytest-timeout}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module yarl >= 0.13.0}
# /SECTION
# SECTION docs
BuildRequires: python3-Sphinx
BuildRequires: python3-sphinxcontrib-asyncio
BuildRequires: python3-sphinxcontrib-newsfeed
# /SECTION
BuildArch: noarch
%python_subpackages
%description
Asynchronous HTTP client/server framework for Python.
- Supports both the client and server side of HTTP protocol.
- Supports both client and server WebSockets out-of-the-box.
- Web-server has middleware and pluggable routing.
%prep
%autosetup -p1 -n aiohttp-cors-%{version}
# remove code coverage flags from pytest
sed -i '/addopts/d' setup.cfg
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest tests/unit
%files %{python_files}
%license LICENSE
%doc CHANGES.rst README.rst
%{python_sitelib}/aiohttp_cors
%{python_sitelib}/aiohttp_cors-%{version}*-info
%changelog