summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-07-14 12:39:41 +0200
committerMichał Górny <mgorny@gentoo.org>2018-07-14 12:39:56 +0200
commitec359b78d0555300752968ebaf7729e0f3023d33 (patch)
tree3e141f6b6894894a12c767677e81abb3038eee45
parentdev-lang/swi-prolog: bump development version (diff)
downloadgentoo-ec359b78d0555300752968ebaf7729e0f3023d33.tar.gz
gentoo-ec359b78d0555300752968ebaf7729e0f3023d33.tar.bz2
gentoo-ec359b78d0555300752968ebaf7729e0f3023d33.zip
dev-python/urllib3: Add tornado-5 support
-rw-r--r--dev-python/urllib3/files/urllib3-1.23-tornado5.patch72
-rw-r--r--dev-python/urllib3/urllib3-1.23.ebuild6
2 files changed, 77 insertions, 1 deletions
diff --git a/dev-python/urllib3/files/urllib3-1.23-tornado5.patch b/dev-python/urllib3/files/urllib3-1.23-tornado5.patch
new file mode 100644
index 00000000000..b5224564c56
--- /dev/null
+++ b/dev-python/urllib3/files/urllib3-1.23-tornado5.patch
@@ -0,0 +1,72 @@
+From f8c3e96df731eccda202e0dc909f0a51cdc41267 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 14 Jul 2018 12:21:50 +0200
+Subject: [PATCH] dummyserver: Update for tornado-5 API changes
+
+Tornado 5 has apparently removed support for multiple IOLoops,
+and appropriately removed the io_loop parameter to the server class
+in favor of using IOLoop.current(). Update the tests to use the latter.
+The code remains compatible with tornado-4.
+---
+ dummyserver/server.py | 9 +++++----
+ dummyserver/testcase.py | 4 ++--
+ 2 files changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/dummyserver/server.py b/dummyserver/server.py
+index e1745b7..3ba5124 100755
+--- a/dummyserver/server.py
++++ b/dummyserver/server.py
+@@ -226,15 +226,16 @@ def bind_sockets(port, address=None, family=socket.AF_UNSPEC, backlog=128,
+
+
+ def run_tornado_app(app, io_loop, certs, scheme, host):
++ assert io_loop == tornado.ioloop.IOLoop.current()
++
+ # We can't use fromtimestamp(0) because of CPython issue 29097, so we'll
+ # just construct the datetime object directly.
+ app.last_req = datetime(1970, 1, 1)
+
+ if scheme == 'https':
+- http_server = tornado.httpserver.HTTPServer(app, ssl_options=certs,
+- io_loop=io_loop)
++ http_server = tornado.httpserver.HTTPServer(app, ssl_options=certs)
+ else:
+- http_server = tornado.httpserver.HTTPServer(app, io_loop=io_loop)
++ http_server = tornado.httpserver.HTTPServer(app)
+
+ sockets = bind_sockets(None, address=host)
+ port = sockets[0].getsockname()[1]
+@@ -268,7 +269,7 @@ if __name__ == '__main__':
+ from .testcase import TestingApp
+ host = '127.0.0.1'
+
+- io_loop = tornado.ioloop.IOLoop()
++ io_loop = tornado.ioloop.IOLoop.current()
+ app = tornado.web.Application([(r".*", TestingApp)])
+ server, port = run_tornado_app(app, io_loop, None,
+ 'http', host)
+diff --git a/dummyserver/testcase.py b/dummyserver/testcase.py
+index f73f028..d9ff8cf 100644
+--- a/dummyserver/testcase.py
++++ b/dummyserver/testcase.py
+@@ -124,7 +124,7 @@ class HTTPDummyServerTestCase(unittest.TestCase):
+
+ @classmethod
+ def _start_server(cls):
+- cls.io_loop = ioloop.IOLoop()
++ cls.io_loop = ioloop.IOLoop.current()
+ app = web.Application([(r".*", TestingApp)])
+ cls.server, cls.port = run_tornado_app(app, cls.io_loop, cls.certs,
+ cls.scheme, cls.host)
+@@ -170,7 +170,7 @@ class HTTPDummyProxyTestCase(unittest.TestCase):
+
+ @classmethod
+ def setUpClass(cls):
+- cls.io_loop = ioloop.IOLoop()
++ cls.io_loop = ioloop.IOLoop.current()
+
+ app = web.Application([(r'.*', TestingApp)])
+ cls.http_server, cls.http_port = run_tornado_app(
+--
+2.18.0
+
diff --git a/dev-python/urllib3/urllib3-1.23.ebuild b/dev-python/urllib3/urllib3-1.23.ebuild
index 7ac1e3770eb..7dad09add02 100644
--- a/dev-python/urllib3/urllib3-1.23.ebuild
+++ b/dev-python/urllib3/urllib3-1.23.ebuild
@@ -33,7 +33,6 @@ DEPEND="
test? (
${RDEPEND}
>=www-servers/tornado-4.2.1[$(python_gen_usedep 'python*')]
- <www-servers/tornado-5.0.0[$(python_gen_usedep 'python*')]
dev-python/pytest[${PYTHON_USEDEP}]
)
doc? (
@@ -45,6 +44,11 @@ DEPEND="
# Testsuite written requiring mock to be installed under all Cpythons
python_prepare_all() {
+ local PATCHES=(
+ # support tornado-5
+ "${FILESDIR}"/urllib3-1.23-tornado5.patch
+ )
+
# skip appengine tests
rm -r test/appengine || die