From ec359b78d0555300752968ebaf7729e0f3023d33 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sat, 14 Jul 2018 12:39:41 +0200 Subject: dev-python/urllib3: Add tornado-5 support --- .../urllib3/files/urllib3-1.23-tornado5.patch | 72 ++++++++++++++++++++++ dev-python/urllib3/urllib3-1.23.ebuild | 6 +- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 dev-python/urllib3/files/urllib3-1.23-tornado5.patch (limited to 'dev-python') 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 000000000000..b5224564c56a --- /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?= +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 7ac1e3770ebf..7dad09add027 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*')] -