summaryrefslogtreecommitdiff
path: root/dev-python
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-05-20 08:30:48 +0200
committerMichał Górny <mgorny@gentoo.org>2021-05-20 09:25:13 +0200
commit2eaa10576748e207f6a801dcc327349ef69dc420 (patch)
tree8f30ed6708ea859306e13e357eaf4b87a4ab0425 /dev-python
parent3dc367983f6298932d5cc04c01a7c43d846271c3 (diff)
downloadgentoo-2eaa10576748e207f6a801dcc327349ef69dc420.tar.gz
gentoo-2eaa10576748e207f6a801dcc327349ef69dc420.tar.bz2
gentoo-2eaa10576748e207f6a801dcc327349ef69dc420.zip
dev-python/werkzeug: Backport py3.10 support
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r--dev-python/werkzeug/files/werkzeug-2.0.1-py310.patch103
-rw-r--r--dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild47
2 files changed, 150 insertions, 0 deletions
diff --git a/dev-python/werkzeug/files/werkzeug-2.0.1-py310.patch b/dev-python/werkzeug/files/werkzeug-2.0.1-py310.patch
new file mode 100644
index 000000000000..56a0166d334d
--- /dev/null
+++ b/dev-python/werkzeug/files/werkzeug-2.0.1-py310.patch
@@ -0,0 +1,103 @@
+From 584f3cff7d5cb8a588189ae1137b814cf5c47e05 Mon Sep 17 00:00:00 2001
+From: David Lord <davidism@gmail.com>
+Date: Wed, 19 May 2021 20:01:58 -0700
+Subject: [PATCH] address deprecation warnings from Python 3.10b1
+
+---
+ tests/conftest.py | 5 ++++-
+ tests/test_local.py | 34 +++++++++++++++++++++++++---------
+ 2 files changed, 29 insertions(+), 10 deletions(-)
+
+diff --git a/tests/conftest.py b/tests/conftest.py
+index 3b5cbd71c..4ad1ff23e 100644
+--- a/tests/conftest.py
++++ b/tests/conftest.py
+@@ -66,7 +66,10 @@ def connect(self, **kwargs):
+
+ if protocol == "https":
+ if "context" not in kwargs:
+- kwargs["context"] = ssl.SSLContext()
++ context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
++ context.check_hostname = False
++ context.verify_mode = ssl.CERT_NONE
++ kwargs["context"] = context
+
+ return http.client.HTTPSConnection(self.addr, **kwargs)
+
+diff --git a/tests/test_local.py b/tests/test_local.py
+index 537fc32fb..b5c392890 100644
+--- a/tests/test_local.py
++++ b/tests/test_local.py
+@@ -12,6 +12,18 @@
+ from werkzeug import local
+
+
++if sys.version_info < (3, 7):
++
++ def run_async(coro):
++ return asyncio.get_event_loop().run_until_complete(coro)
++
++
++else:
++
++ def run_async(coro):
++ return asyncio.run(coro)
++
++
+ def test_basic_local():
+ ns = local.Local()
+ ns.foo = 0
+@@ -55,9 +67,11 @@ async def value_setter(idx):
+ await asyncio.sleep(0.02)
+ values.append(ns.foo)
+
+- loop = asyncio.get_event_loop()
+- futures = [asyncio.ensure_future(value_setter(idx)) for idx in [1, 2, 3]]
+- loop.run_until_complete(asyncio.gather(*futures))
++ async def main():
++ futures = [asyncio.ensure_future(value_setter(i)) for i in [1, 2, 3]]
++ await asyncio.gather(*futures)
++
++ run_async(main())
+ assert sorted(values) == [1, 2, 3]
+
+ def delfoo():
+@@ -118,9 +132,11 @@ async def task():
+ ls.push(1)
+ assert len(ls._local.stack) == 2
+
+- loop = asyncio.get_event_loop()
+- futures = [asyncio.ensure_future(task()) for _ in range(3)]
+- loop.run_until_complete(asyncio.gather(*futures))
++ async def main():
++ futures = [asyncio.ensure_future(task()) for _ in range(3)]
++ await asyncio.gather(*futures)
++
++ run_async(main())
+
+
+ @pytest.mark.skipif(
+@@ -571,7 +587,7 @@ async def get():
+ async def main():
+ return await p
+
+- out = asyncio.get_event_loop().run_until_complete(main())
++ out = run_async(main())
+ assert out == 1
+
+
+@@ -599,7 +615,7 @@ async def main():
+
+ return out
+
+- out = asyncio.get_event_loop().run_until_complete(main())
++ out = run_async(main())
+ assert out == [2, 1, 0]
+
+
+@@ -623,4 +639,4 @@ async def main():
+ assert p.value == 2
+ return True
+
+- assert asyncio.get_event_loop().run_until_complete(main())
++ assert run_async(main())
diff --git a/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild b/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild
new file mode 100644
index 000000000000..38fc4aaa0012
--- /dev/null
+++ b/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7..10} pypy3 )
+
+inherit distutils-r1
+
+DESCRIPTION="Collection of various utilities for WSGI applications"
+HOMEPAGE="
+ https://werkzeug.palletsprojects.com/
+ https://pypi.org/project/Werkzeug/
+ https://github.com/pallets/werkzeug/"
+SRC_URI="
+ https://github.com/pallets/werkzeug/archive/${PV}.tar.gz
+ -> ${P}.gh.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+
+BDEPEND="
+ test? (
+ dev-python/cryptography[${PYTHON_USEDEP}]
+ !hppa? ( !ia64? (
+ $(python_gen_cond_dep '
+ dev-python/greenlet[${PYTHON_USEDEP}]
+ ' 'python*')
+ ) )
+ dev-python/pytest-timeout[${PYTHON_USEDEP}]
+ dev-python/pytest-xprocess[${PYTHON_USEDEP}]
+ dev-python/watchdog[${PYTHON_USEDEP}]
+ ~dev-python/werkzeug-${PV}[${PYTHON_USEDEP}]
+ )"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+ "${FILESDIR}"/${P}-py310.patch
+)
+
+python_test() {
+ # the default portage tempdir is too long for AF_UNIX sockets
+ local -x TMPDIR=/tmp
+ epytest -p no:httpbin tests
+}