1 |
commit: ec359b78d0555300752968ebaf7729e0f3023d33 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jul 14 10:39:41 2018 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jul 14 10:39:56 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec359b78 |
7 |
|
8 |
dev-python/urllib3: Add tornado-5 support |
9 |
|
10 |
.../urllib3/files/urllib3-1.23-tornado5.patch | 72 ++++++++++++++++++++++ |
11 |
dev-python/urllib3/urllib3-1.23.ebuild | 6 +- |
12 |
2 files changed, 77 insertions(+), 1 deletion(-) |
13 |
|
14 |
diff --git a/dev-python/urllib3/files/urllib3-1.23-tornado5.patch b/dev-python/urllib3/files/urllib3-1.23-tornado5.patch |
15 |
new file mode 100644 |
16 |
index 00000000000..b5224564c56 |
17 |
--- /dev/null |
18 |
+++ b/dev-python/urllib3/files/urllib3-1.23-tornado5.patch |
19 |
@@ -0,0 +1,72 @@ |
20 |
+From f8c3e96df731eccda202e0dc909f0a51cdc41267 Mon Sep 17 00:00:00 2001 |
21 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
22 |
+Date: Sat, 14 Jul 2018 12:21:50 +0200 |
23 |
+Subject: [PATCH] dummyserver: Update for tornado-5 API changes |
24 |
+ |
25 |
+Tornado 5 has apparently removed support for multiple IOLoops, |
26 |
+and appropriately removed the io_loop parameter to the server class |
27 |
+in favor of using IOLoop.current(). Update the tests to use the latter. |
28 |
+The code remains compatible with tornado-4. |
29 |
+--- |
30 |
+ dummyserver/server.py | 9 +++++---- |
31 |
+ dummyserver/testcase.py | 4 ++-- |
32 |
+ 2 files changed, 7 insertions(+), 6 deletions(-) |
33 |
+ |
34 |
+diff --git a/dummyserver/server.py b/dummyserver/server.py |
35 |
+index e1745b7..3ba5124 100755 |
36 |
+--- a/dummyserver/server.py |
37 |
++++ b/dummyserver/server.py |
38 |
+@@ -226,15 +226,16 @@ def bind_sockets(port, address=None, family=socket.AF_UNSPEC, backlog=128, |
39 |
+ |
40 |
+ |
41 |
+ def run_tornado_app(app, io_loop, certs, scheme, host): |
42 |
++ assert io_loop == tornado.ioloop.IOLoop.current() |
43 |
++ |
44 |
+ # We can't use fromtimestamp(0) because of CPython issue 29097, so we'll |
45 |
+ # just construct the datetime object directly. |
46 |
+ app.last_req = datetime(1970, 1, 1) |
47 |
+ |
48 |
+ if scheme == 'https': |
49 |
+- http_server = tornado.httpserver.HTTPServer(app, ssl_options=certs, |
50 |
+- io_loop=io_loop) |
51 |
++ http_server = tornado.httpserver.HTTPServer(app, ssl_options=certs) |
52 |
+ else: |
53 |
+- http_server = tornado.httpserver.HTTPServer(app, io_loop=io_loop) |
54 |
++ http_server = tornado.httpserver.HTTPServer(app) |
55 |
+ |
56 |
+ sockets = bind_sockets(None, address=host) |
57 |
+ port = sockets[0].getsockname()[1] |
58 |
+@@ -268,7 +269,7 @@ if __name__ == '__main__': |
59 |
+ from .testcase import TestingApp |
60 |
+ host = '127.0.0.1' |
61 |
+ |
62 |
+- io_loop = tornado.ioloop.IOLoop() |
63 |
++ io_loop = tornado.ioloop.IOLoop.current() |
64 |
+ app = tornado.web.Application([(r".*", TestingApp)]) |
65 |
+ server, port = run_tornado_app(app, io_loop, None, |
66 |
+ 'http', host) |
67 |
+diff --git a/dummyserver/testcase.py b/dummyserver/testcase.py |
68 |
+index f73f028..d9ff8cf 100644 |
69 |
+--- a/dummyserver/testcase.py |
70 |
++++ b/dummyserver/testcase.py |
71 |
+@@ -124,7 +124,7 @@ class HTTPDummyServerTestCase(unittest.TestCase): |
72 |
+ |
73 |
+ @classmethod |
74 |
+ def _start_server(cls): |
75 |
+- cls.io_loop = ioloop.IOLoop() |
76 |
++ cls.io_loop = ioloop.IOLoop.current() |
77 |
+ app = web.Application([(r".*", TestingApp)]) |
78 |
+ cls.server, cls.port = run_tornado_app(app, cls.io_loop, cls.certs, |
79 |
+ cls.scheme, cls.host) |
80 |
+@@ -170,7 +170,7 @@ class HTTPDummyProxyTestCase(unittest.TestCase): |
81 |
+ |
82 |
+ @classmethod |
83 |
+ def setUpClass(cls): |
84 |
+- cls.io_loop = ioloop.IOLoop() |
85 |
++ cls.io_loop = ioloop.IOLoop.current() |
86 |
+ |
87 |
+ app = web.Application([(r'.*', TestingApp)]) |
88 |
+ cls.http_server, cls.http_port = run_tornado_app( |
89 |
+-- |
90 |
+2.18.0 |
91 |
+ |
92 |
|
93 |
diff --git a/dev-python/urllib3/urllib3-1.23.ebuild b/dev-python/urllib3/urllib3-1.23.ebuild |
94 |
index 7ac1e3770eb..7dad09add02 100644 |
95 |
--- a/dev-python/urllib3/urllib3-1.23.ebuild |
96 |
+++ b/dev-python/urllib3/urllib3-1.23.ebuild |
97 |
@@ -33,7 +33,6 @@ DEPEND=" |
98 |
test? ( |
99 |
${RDEPEND} |
100 |
>=www-servers/tornado-4.2.1[$(python_gen_usedep 'python*')] |
101 |
- <www-servers/tornado-5.0.0[$(python_gen_usedep 'python*')] |
102 |
dev-python/pytest[${PYTHON_USEDEP}] |
103 |
) |
104 |
doc? ( |
105 |
@@ -45,6 +44,11 @@ DEPEND=" |
106 |
# Testsuite written requiring mock to be installed under all Cpythons |
107 |
|
108 |
python_prepare_all() { |
109 |
+ local PATCHES=( |
110 |
+ # support tornado-5 |
111 |
+ "${FILESDIR}"/urllib3-1.23-tornado5.patch |
112 |
+ ) |
113 |
+ |
114 |
# skip appengine tests |
115 |
rm -r test/appengine || die |