public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/urllib3/, dev-python/urllib3/files/
@ 2018-07-14 10:40 Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2018-07-14 10:40 UTC (permalink / raw
  To: gentoo-commits

commit:     ec359b78d0555300752968ebaf7729e0f3023d33
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 14 10:39:41 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul 14 10:39:56 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec359b78

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(-)

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
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/urllib3/, dev-python/urllib3/files/
@ 2020-12-23  2:03 Sam James
  0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2020-12-23  2:03 UTC (permalink / raw
  To: gentoo-commits

commit:     c83238e04752d5b09d12089264b5c9ea6ca861fa
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 23 02:03:36 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 23 02:03:36 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c83238e0

dev-python/urllib3: add test_proxy_rejection test hang patch

Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...1.26.2-fix-test_proxy_rejection-test-hang.patch | 87 ++++++++++++++++++++++
 dev-python/urllib3/urllib3-1.26.2-r1.ebuild        |  4 +
 dev-python/urllib3/urllib3-1.26.2.ebuild           |  4 +
 3 files changed, 95 insertions(+)

diff --git a/dev-python/urllib3/files/urllib3-1.26.2-fix-test_proxy_rejection-test-hang.patch b/dev-python/urllib3/files/urllib3-1.26.2-fix-test_proxy_rejection-test-hang.patch
new file mode 100644
index 00000000000..2af65e84f01
--- /dev/null
+++ b/dev-python/urllib3/files/urllib3-1.26.2-fix-test_proxy_rejection-test-hang.patch
@@ -0,0 +1,87 @@
+Fixes a hang on test_proxy_rejection.
+https://github.com/urllib3/urllib3/commit/087d4de8487379033970898866625c00e0d51c85.patch
+
+From 087d4de8487379033970898866625c00e0d51c85 Mon Sep 17 00:00:00 2001
+From: Quentin Pradet <quentin.pradet@gmail.com>
+Date: Tue, 3 Nov 2020 17:15:50 +0400
+Subject: [PATCH] Fix test_proxy_rejection even with two localhost entries
+
+---
+ test/contrib/test_socks.py | 34 +++++++++++++++++++++++++++++++---
+ 1 file changed, 31 insertions(+), 3 deletions(-)
+
+diff --git a/test/contrib/test_socks.py b/test/contrib/test_socks.py
+index 1966513c1..ed716f188 100644
+--- a/test/contrib/test_socks.py
++++ b/test/contrib/test_socks.py
+@@ -1,8 +1,12 @@
++from __future__ import absolute_import
++
+ import socket
+ import threading
++from socket import getaddrinfo as real_getaddrinfo
+ from test import SHORT_TIMEOUT
+ 
+ import pytest
++import socks as py_socks
+ 
+ from dummyserver.server import DEFAULT_CA, DEFAULT_CERTS
+ from dummyserver.testcase import IPV4SocketDummyServerTestCase
+@@ -87,6 +91,26 @@ def _address_from_socket(sock):
+         raise RuntimeError("Unexpected addr type: %r" % addr_type)
+ 
+ 
++def _set_up_fake_getaddrinfo(monkeypatch):
++    # Work around https://github.com/urllib3/urllib3/pull/2034
++    # Nothing prevents localhost to point to two different IPs. For example, in the
++    # Ubuntu set up by GitHub Actions, localhost points both to 127.0.0.1 and ::1.
++    #
++    # In case of failure, PySocks will try the same request on both IPs, but our
++    # handle_socks[45]_negotiation functions don't handle retries, which leads either to
++    # a deadlock or a timeout in case of a failure on the first address.
++    #
++    # However, some tests need to exercise failure. We don't want retries there, but
++    # can't affect PySocks retries via its API. Instead, we monkeypatch PySocks so that
++    # it only sees a single address, which effectively disables retries.
++    def fake_getaddrinfo(addr, port, family, socket_type):
++        gai_list = real_getaddrinfo(addr, port, family, socket_type)
++        gai_list = [gai for gai in gai_list if gai[0] == socket.AF_INET]
++        return gai_list[:1]
++
++    monkeypatch.setattr(py_socks.socket, "getaddrinfo", fake_getaddrinfo)
++
++
+ def handle_socks5_negotiation(sock, negotiate, username=None, password=None):
+     """
+     Handle the SOCKS5 handshake.
+@@ -334,7 +358,8 @@ def request_handler(listener):
+             with pytest.raises(NewConnectionError):
+                 pm.request("GET", "http://example.com", retries=False)
+ 
+-    def test_proxy_rejection(self):
++    def test_proxy_rejection(self, monkeypatch):
++        _set_up_fake_getaddrinfo(monkeypatch)
+         evt = threading.Event()
+ 
+         def request_handler(listener):
+@@ -429,7 +454,9 @@ def request_handler(listener):
+             assert response.data == b""
+             assert response.headers["Server"] == "SocksTestServer"
+ 
+-    def test_socks_with_invalid_password(self):
++    def test_socks_with_invalid_password(self, monkeypatch):
++        _set_up_fake_getaddrinfo(monkeypatch)
++
+         def request_handler(listener):
+             sock = listener.accept()[0]
+ 
+@@ -592,7 +619,8 @@ def request_handler(listener):
+             response = pm.request("GET", "http://example.com")
+             assert response.status == 200
+ 
+-    def test_proxy_rejection(self):
++    def test_proxy_rejection(self, monkeypatch):
++        _set_up_fake_getaddrinfo(monkeypatch)
+         evt = threading.Event()
+ 
+         def request_handler(listener):

diff --git a/dev-python/urllib3/urllib3-1.26.2-r1.ebuild b/dev-python/urllib3/urllib3-1.26.2-r1.ebuild
index 73147412195..434b386f83d 100644
--- a/dev-python/urllib3/urllib3-1.26.2-r1.ebuild
+++ b/dev-python/urllib3/urllib3-1.26.2-r1.ebuild
@@ -41,6 +41,10 @@ BDEPEND="
 	)
 "
 
+PATCHES=(
+	"${FILESDIR}/${P}-fix-test_proxy_rejection-test-hang.patch"
+)
+
 python_prepare_all() {
 	# https://github.com/urllib3/urllib3/issues/1756
 	sed -e 's:10.255.255.1:240.0.0.0:' \

diff --git a/dev-python/urllib3/urllib3-1.26.2.ebuild b/dev-python/urllib3/urllib3-1.26.2.ebuild
index 88cad5ac516..607f7c5c9d8 100644
--- a/dev-python/urllib3/urllib3-1.26.2.ebuild
+++ b/dev-python/urllib3/urllib3-1.26.2.ebuild
@@ -41,6 +41,10 @@ BDEPEND="
 	)
 "
 
+PATCHES=(
+	"${FILESDIR}/${P}-fix-test_proxy_rejection-test-hang.patch"
+)
+
 python_prepare_all() {
 	# https://github.com/urllib3/urllib3/issues/1756
 	sed -e 's:10.255.255.1:240.0.0.0:' \


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/urllib3/, dev-python/urllib3/files/
@ 2021-03-15  8:52 Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2021-03-15  8:52 UTC (permalink / raw
  To: gentoo-commits

commit:     da362b40c877b33ed5304bf4bf55bb290a318735
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 15 08:50:10 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 15 08:52:26 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da362b40

dev-python/urllib3: Remove old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/urllib3/Manifest                        |  1 -
 .../files/urllib3-1.26.2-byteswarning.patch        | 25 -------
 ...1.26.2-fix-test_proxy_rejection-test-hang.patch | 87 ----------------------
 dev-python/urllib3/urllib3-1.26.2-r1.ebuild        | 69 -----------------
 dev-python/urllib3/urllib3-1.26.2-r2.ebuild        | 70 -----------------
 dev-python/urllib3/urllib3-1.26.2-r3.ebuild        | 77 -------------------
 dev-python/urllib3/urllib3-1.26.2.ebuild           | 69 -----------------
 7 files changed, 398 deletions(-)

diff --git a/dev-python/urllib3/Manifest b/dev-python/urllib3/Manifest
index b64063b0db6..37d05f6a9f6 100644
--- a/dev-python/urllib3/Manifest
+++ b/dev-python/urllib3/Manifest
@@ -1,3 +1,2 @@
 DIST urllib3-1.25.11.tar.gz 260300 BLAKE2B 06bd2107bad479e36c6474f95567c3ecb119d18b193b358df9e345e4d09392366255b21597b26fbf2374220b921cc2117a1972f88021c3a6ebac3844a319acbe SHA512 58f77edb9ced62cbac7b0baf2651c07f9f413267f103730ee25f08c5d4d0bf52a2ace02f58841bcd55652db677c7a1dc9a756681e7e32d590bc69d8b93e8f173
-DIST urllib3-1.26.2.tar.gz 286877 BLAKE2B dc5884e2561fae476ba8695cf9e50abb63d8dfc45ad6219d07ba30ecae48e5f27fbdd9a324c0e71f739555c90a3653f18eda513f2ea45b76abcd8c6c714ec0f7 SHA512 4de7cf844ed0deb83c4129e1b1742eafefe95035dd7ffbeaeaaccabca8bd361de9fa240882ea4dec16a7f0b5c5684416656f0d58bea15e7aefd4132024a25c9e
 DIST urllib3-1.26.3.tar.gz 292598 BLAKE2B 31bcf03debd74a65004484f12c9ad4d71b8c065344f1e377c2f4a695fc0778cf4cb503dbe243133a20d5779ba4bea455213c62aa5dc3815a994acb4e0adf46b6 SHA512 d0dde67880212dc134add3e16e0aa391170963ed26b9a7eb65399235251131ce25488268df7b2f933afc71c9a94e55e08404f9326c0bf5142869dac912d3ee01

diff --git a/dev-python/urllib3/files/urllib3-1.26.2-byteswarning.patch b/dev-python/urllib3/files/urllib3-1.26.2-byteswarning.patch
deleted file mode 100644
index dfa761c5631..00000000000
--- a/dev-python/urllib3/files/urllib3-1.26.2-byteswarning.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From bab9ca9f7148d6a7f15b83cfa1126bf1c8ceb17d Mon Sep 17 00:00:00 2001
-From: Quentin Pradet <quentin@pradet.me>
-Date: Tue, 26 Jan 2021 18:04:17 +0400
-Subject: [PATCH] Don't compare bytes and str in putheader()
-
----
- src/urllib3/connection.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py
-index 660d679c..387f3770 100644
---- a/src/urllib3/connection.py
-+++ b/src/urllib3/connection.py
-@@ -215,7 +215,7 @@ class HTTPConnection(_HTTPConnection, object):
- 
-     def putheader(self, header, *values):
-         """"""
--        if SKIP_HEADER not in values:
-+        if not any(isinstance(v, str) and v == SKIP_HEADER for v in values):
-             _HTTPConnection.putheader(self, header, *values)
-         elif six.ensure_str(header.lower()) not in SKIPPABLE_HEADERS:
-             raise ValueError(
--- 
-2.30.0
-

diff --git a/dev-python/urllib3/files/urllib3-1.26.2-fix-test_proxy_rejection-test-hang.patch b/dev-python/urllib3/files/urllib3-1.26.2-fix-test_proxy_rejection-test-hang.patch
deleted file mode 100644
index 2af65e84f01..00000000000
--- a/dev-python/urllib3/files/urllib3-1.26.2-fix-test_proxy_rejection-test-hang.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-Fixes a hang on test_proxy_rejection.
-https://github.com/urllib3/urllib3/commit/087d4de8487379033970898866625c00e0d51c85.patch
-
-From 087d4de8487379033970898866625c00e0d51c85 Mon Sep 17 00:00:00 2001
-From: Quentin Pradet <quentin.pradet@gmail.com>
-Date: Tue, 3 Nov 2020 17:15:50 +0400
-Subject: [PATCH] Fix test_proxy_rejection even with two localhost entries
-
----
- test/contrib/test_socks.py | 34 +++++++++++++++++++++++++++++++---
- 1 file changed, 31 insertions(+), 3 deletions(-)
-
-diff --git a/test/contrib/test_socks.py b/test/contrib/test_socks.py
-index 1966513c1..ed716f188 100644
---- a/test/contrib/test_socks.py
-+++ b/test/contrib/test_socks.py
-@@ -1,8 +1,12 @@
-+from __future__ import absolute_import
-+
- import socket
- import threading
-+from socket import getaddrinfo as real_getaddrinfo
- from test import SHORT_TIMEOUT
- 
- import pytest
-+import socks as py_socks
- 
- from dummyserver.server import DEFAULT_CA, DEFAULT_CERTS
- from dummyserver.testcase import IPV4SocketDummyServerTestCase
-@@ -87,6 +91,26 @@ def _address_from_socket(sock):
-         raise RuntimeError("Unexpected addr type: %r" % addr_type)
- 
- 
-+def _set_up_fake_getaddrinfo(monkeypatch):
-+    # Work around https://github.com/urllib3/urllib3/pull/2034
-+    # Nothing prevents localhost to point to two different IPs. For example, in the
-+    # Ubuntu set up by GitHub Actions, localhost points both to 127.0.0.1 and ::1.
-+    #
-+    # In case of failure, PySocks will try the same request on both IPs, but our
-+    # handle_socks[45]_negotiation functions don't handle retries, which leads either to
-+    # a deadlock or a timeout in case of a failure on the first address.
-+    #
-+    # However, some tests need to exercise failure. We don't want retries there, but
-+    # can't affect PySocks retries via its API. Instead, we monkeypatch PySocks so that
-+    # it only sees a single address, which effectively disables retries.
-+    def fake_getaddrinfo(addr, port, family, socket_type):
-+        gai_list = real_getaddrinfo(addr, port, family, socket_type)
-+        gai_list = [gai for gai in gai_list if gai[0] == socket.AF_INET]
-+        return gai_list[:1]
-+
-+    monkeypatch.setattr(py_socks.socket, "getaddrinfo", fake_getaddrinfo)
-+
-+
- def handle_socks5_negotiation(sock, negotiate, username=None, password=None):
-     """
-     Handle the SOCKS5 handshake.
-@@ -334,7 +358,8 @@ def request_handler(listener):
-             with pytest.raises(NewConnectionError):
-                 pm.request("GET", "http://example.com", retries=False)
- 
--    def test_proxy_rejection(self):
-+    def test_proxy_rejection(self, monkeypatch):
-+        _set_up_fake_getaddrinfo(monkeypatch)
-         evt = threading.Event()
- 
-         def request_handler(listener):
-@@ -429,7 +454,9 @@ def request_handler(listener):
-             assert response.data == b""
-             assert response.headers["Server"] == "SocksTestServer"
- 
--    def test_socks_with_invalid_password(self):
-+    def test_socks_with_invalid_password(self, monkeypatch):
-+        _set_up_fake_getaddrinfo(monkeypatch)
-+
-         def request_handler(listener):
-             sock = listener.accept()[0]
- 
-@@ -592,7 +619,8 @@ def request_handler(listener):
-             response = pm.request("GET", "http://example.com")
-             assert response.status == 200
- 
--    def test_proxy_rejection(self):
-+    def test_proxy_rejection(self, monkeypatch):
-+        _set_up_fake_getaddrinfo(monkeypatch)
-         evt = threading.Event()
- 
-         def request_handler(listener):

diff --git a/dev-python/urllib3/urllib3-1.26.2-r1.ebuild b/dev-python/urllib3/urllib3-1.26.2-r1.ebuild
deleted file mode 100644
index fe6cc770423..00000000000
--- a/dev-python/urllib3/urllib3-1.26.2-r1.ebuild
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} pypy3 )
-PYTHON_REQ_USE="ssl(+)"
-
-inherit distutils-r1
-
-DESCRIPTION="HTTP library with thread-safe connection pooling, file post, and more"
-HOMEPAGE="https://github.com/urllib3/urllib3"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm arm64 hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 sparc ~x86 ~x64-cygwin ~amd64-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="brotli test"
-RESTRICT="!test? ( test )"
-
-RDEPEND="
-	>=dev-python/PySocks-1.5.8[${PYTHON_USEDEP}]
-	<dev-python/PySocks-2.0[${PYTHON_USEDEP}]
-	dev-python/certifi[${PYTHON_USEDEP}]
-	>=dev-python/cryptography-1.3.4[${PYTHON_USEDEP}]
-	>=dev-python/pyopenssl-0.14[${PYTHON_USEDEP}]
-	>=dev-python/idna-2.0.0[${PYTHON_USEDEP}]
-	brotli? ( dev-python/brotlicffi[${PYTHON_USEDEP}] )
-"
-BDEPEND="
-	test? (
-		$(python_gen_cond_dep "
-			${RDEPEND}
-			dev-python/brotlicffi[\${PYTHON_USEDEP}]
-			dev-python/mock[\${PYTHON_USEDEP}]
-			dev-python/pytest[\${PYTHON_USEDEP}]
-			dev-python/pytest-freezegun[\${PYTHON_USEDEP}]
-			>=dev-python/trustme-0.5.3[\${PYTHON_USEDEP}]
-			>=www-servers/tornado-4.2.1[\${PYTHON_USEDEP}]
-		" python3_{6,7,8,9})
-	)
-"
-
-PATCHES=(
-	"${FILESDIR}/${P}-fix-test_proxy_rejection-test-hang.patch"
-)
-
-python_prepare_all() {
-	# https://github.com/urllib3/urllib3/issues/1756
-	sed -e 's:10.255.255.1:240.0.0.0:' \
-		-i test/__init__.py || die
-	# tests failing if 'localhost.' cannot be resolved
-	sed -e 's:test_dotted_fqdn:_&:' \
-		-i test/with_dummyserver/test_https.py || die
-	sed -e 's:test_request_host_header_ignores_fqdn_dot:_&:' \
-		-i test/with_dummyserver/test_socketlevel.py || die
-
-	distutils-r1_python_prepare_all
-}
-
-python_test() {
-	local -x CI=1
-	# FIXME: get tornado ported
-	case ${EPYTHON} in
-		python3*)
-			pytest -vv || die "Tests fail with ${EPYTHON}"
-			;;
-	esac
-}

diff --git a/dev-python/urllib3/urllib3-1.26.2-r2.ebuild b/dev-python/urllib3/urllib3-1.26.2-r2.ebuild
deleted file mode 100644
index 5d6d29d94f1..00000000000
--- a/dev-python/urllib3/urllib3-1.26.2-r2.ebuild
+++ /dev/null
@@ -1,70 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} pypy3 )
-PYTHON_REQ_USE="ssl(+)"
-
-inherit distutils-r1
-
-DESCRIPTION="HTTP library with thread-safe connection pooling, file post, and more"
-HOMEPAGE="https://github.com/urllib3/urllib3"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv s390 sparc x86 ~x64-macos"
-IUSE="brotli test"
-RESTRICT="!test? ( test )"
-
-RDEPEND="
-	>=dev-python/PySocks-1.5.8[${PYTHON_USEDEP}]
-	<dev-python/PySocks-2.0[${PYTHON_USEDEP}]
-	dev-python/certifi[${PYTHON_USEDEP}]
-	>=dev-python/cryptography-1.3.4[${PYTHON_USEDEP}]
-	>=dev-python/pyopenssl-0.14[${PYTHON_USEDEP}]
-	>=dev-python/idna-2.0.0[${PYTHON_USEDEP}]
-	brotli? ( dev-python/brotlipy[${PYTHON_USEDEP}] )
-"
-BDEPEND="
-	test? (
-		$(python_gen_cond_dep "
-			${RDEPEND}
-			dev-python/brotlipy[\${PYTHON_USEDEP}]
-			dev-python/mock[\${PYTHON_USEDEP}]
-			dev-python/pytest[\${PYTHON_USEDEP}]
-			dev-python/pytest-freezegun[\${PYTHON_USEDEP}]
-			>=dev-python/trustme-0.5.3[\${PYTHON_USEDEP}]
-			>=www-servers/tornado-4.2.1[\${PYTHON_USEDEP}]
-		" python3_{6,7,8,9})
-	)
-"
-
-PATCHES=(
-	"${FILESDIR}/${P}-fix-test_proxy_rejection-test-hang.patch"
-	"${FILESDIR}/${P}-byteswarning.patch"
-)
-
-python_prepare_all() {
-	# https://github.com/urllib3/urllib3/issues/1756
-	sed -e 's:10.255.255.1:240.0.0.0:' \
-		-i test/__init__.py || die
-	# tests failing if 'localhost.' cannot be resolved
-	sed -e 's:test_dotted_fqdn:_&:' \
-		-i test/with_dummyserver/test_https.py || die
-	sed -e 's:test_request_host_header_ignores_fqdn_dot:_&:' \
-		-i test/with_dummyserver/test_socketlevel.py || die
-
-	distutils-r1_python_prepare_all
-}
-
-python_test() {
-	local -x CI=1
-	# FIXME: get tornado ported
-	case ${EPYTHON} in
-		python3*)
-			pytest -vv || die "Tests fail with ${EPYTHON}"
-			;;
-	esac
-}

diff --git a/dev-python/urllib3/urllib3-1.26.2-r3.ebuild b/dev-python/urllib3/urllib3-1.26.2-r3.ebuild
deleted file mode 100644
index 33e9f7fbf87..00000000000
--- a/dev-python/urllib3/urllib3-1.26.2-r3.ebuild
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} pypy3 )
-PYTHON_REQ_USE="ssl(+)"
-
-inherit distutils-r1
-
-DESCRIPTION="HTTP library with thread-safe connection pooling, file post, and more"
-HOMEPAGE="https://github.com/urllib3/urllib3"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="brotli test"
-RESTRICT="!test? ( test )"
-
-RDEPEND="
-	>=dev-python/PySocks-1.5.8[${PYTHON_USEDEP}]
-	<dev-python/PySocks-2.0[${PYTHON_USEDEP}]
-	dev-python/certifi[${PYTHON_USEDEP}]
-	>=dev-python/cryptography-1.3.4[${PYTHON_USEDEP}]
-	>=dev-python/pyopenssl-0.14[${PYTHON_USEDEP}]
-	>=dev-python/idna-2.0.0[${PYTHON_USEDEP}]
-	brotli? ( dev-python/brotlicffi[${PYTHON_USEDEP}] )
-"
-BDEPEND="
-	test? (
-		$(python_gen_cond_dep "
-			${RDEPEND}
-			dev-python/brotlicffi[\${PYTHON_USEDEP}]
-			dev-python/mock[\${PYTHON_USEDEP}]
-			dev-python/pytest[\${PYTHON_USEDEP}]
-			dev-python/pytest-freezegun[\${PYTHON_USEDEP}]
-			>=dev-python/trustme-0.5.3[\${PYTHON_USEDEP}]
-			>=www-servers/tornado-4.2.1[\${PYTHON_USEDEP}]
-		" python3_{6,7,8,9})
-	)
-"
-
-PATCHES=(
-	"${FILESDIR}/${P}-fix-test_proxy_rejection-test-hang.patch"
-	"${FILESDIR}/${P}-byteswarning.patch"
-)
-
-python_prepare_all() {
-	# https://github.com/urllib3/urllib3/issues/1756
-	sed -e 's:10.255.255.1:240.0.0.0:' \
-		-i test/__init__.py || die
-	# upstream requires updates to this periodically.  seriously?!
-	sed -e '/RECENT_DATE/s:date(.*):date(2020, 7, 1):' \
-		-i src/urllib3/connection.py || die
-	# tests failing if 'localhost.' cannot be resolved
-	sed -e 's:test_dotted_fqdn:_&:' \
-		-i test/with_dummyserver/test_https.py || die
-	sed -e 's:test_request_host_header_ignores_fqdn_dot:_&:' \
-		-i test/with_dummyserver/test_socketlevel.py || die
-
-	distutils-r1_python_prepare_all
-}
-
-python_test() {
-	local -x CI=1
-	# FIXME: get tornado ported
-	[[ ${EPYTHON} == python3* ]] || continue
-
-	local deselect=(
-		# TODO?
-		test/with_dummyserver/test_socketlevel.py::TestSocketClosing::test_timeout_errors_cause_retries
-	)
-
-	pytest -vv ${deselect[@]/#/--deselect } ||
-		die "Tests fail with ${EPYTHON}"
-}

diff --git a/dev-python/urllib3/urllib3-1.26.2.ebuild b/dev-python/urllib3/urllib3-1.26.2.ebuild
deleted file mode 100644
index 8ccfe1bd51f..00000000000
--- a/dev-python/urllib3/urllib3-1.26.2.ebuild
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} pypy3 )
-PYTHON_REQ_USE="ssl(+)"
-
-inherit distutils-r1
-
-DESCRIPTION="HTTP library with thread-safe connection pooling, file post, and more"
-HOMEPAGE="https://github.com/urllib3/urllib3"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv s390 sparc x86 ~x64-macos"
-IUSE="brotli test"
-RESTRICT="!test? ( test )"
-
-RDEPEND="
-	>=dev-python/PySocks-1.5.8[${PYTHON_USEDEP}]
-	<dev-python/PySocks-2.0[${PYTHON_USEDEP}]
-	dev-python/certifi[${PYTHON_USEDEP}]
-	>=dev-python/cryptography-1.3.4[${PYTHON_USEDEP}]
-	>=dev-python/pyopenssl-0.14[${PYTHON_USEDEP}]
-	>=dev-python/idna-2.0.0[${PYTHON_USEDEP}]
-	brotli? ( dev-python/brotlipy[${PYTHON_USEDEP}] )
-"
-BDEPEND="
-	test? (
-		$(python_gen_cond_dep "
-			${RDEPEND}
-			dev-python/brotlipy[\${PYTHON_USEDEP}]
-			dev-python/mock[\${PYTHON_USEDEP}]
-			dev-python/pytest[\${PYTHON_USEDEP}]
-			dev-python/pytest-freezegun[\${PYTHON_USEDEP}]
-			>=dev-python/trustme-0.5.3[\${PYTHON_USEDEP}]
-			>=www-servers/tornado-4.2.1[\${PYTHON_USEDEP}]
-		" python3_{6,7,8,9})
-	)
-"
-
-PATCHES=(
-	"${FILESDIR}/${P}-fix-test_proxy_rejection-test-hang.patch"
-)
-
-python_prepare_all() {
-	# https://github.com/urllib3/urllib3/issues/1756
-	sed -e 's:10.255.255.1:240.0.0.0:' \
-		-i test/__init__.py || die
-	# tests failing if 'localhost.' cannot be resolved
-	sed -e 's:test_dotted_fqdn:_&:' \
-		-i test/with_dummyserver/test_https.py || die
-	sed -e 's:test_request_host_header_ignores_fqdn_dot:_&:' \
-		-i test/with_dummyserver/test_socketlevel.py || die
-
-	distutils-r1_python_prepare_all
-}
-
-python_test() {
-	local -x CI=1
-	# FIXME: get tornado ported
-	case ${EPYTHON} in
-		python3*)
-			pytest -vv || die "Tests fail with ${EPYTHON}"
-			;;
-	esac
-}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/urllib3/, dev-python/urllib3/files/
@ 2024-02-16 17:16 Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2024-02-16 17:16 UTC (permalink / raw
  To: gentoo-commits

commit:     c886664d717e65f9496d9fdb31e71f89d4ad5e98
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 16 17:05:00 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Feb 16 17:15:52 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c886664d

dev-python/urllib3: Backport an upstream revert to fix regressions

Closes: https://bugs.gentoo.org/924333
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../urllib3/files/urllib3-2.2.0-revert.patch       | 42 ++++++++++++++++++++++
 ...rllib3-2.2.0.ebuild => urllib3-2.2.0-r1.ebuild} |  5 +++
 2 files changed, 47 insertions(+)

diff --git a/dev-python/urllib3/files/urllib3-2.2.0-revert.patch b/dev-python/urllib3/files/urllib3-2.2.0-revert.patch
new file mode 100644
index 000000000000..14175ecec58b
--- /dev/null
+++ b/dev-python/urllib3/files/urllib3-2.2.0-revert.patch
@@ -0,0 +1,42 @@
+From 49b2ddaf07ec9ef65ef12d0218117f20e739ee6e Mon Sep 17 00:00:00 2001
+From: Quentin Pradet <quentin.pradet@gmail.com>
+Date: Fri, 16 Feb 2024 11:35:30 +0400
+Subject: [PATCH] Stop casting request headers to HTTPHeaderDict (#3344)
+
+While this was done to fix a mypy error, we did not notice the
+consequences:
+
+ * This breaks boto3 that subclasses HTTPConnection because
+   HTTPHeaderDict does not support bytes values yet.
+ * When proxying, headers are still a dictionary by default.
+
+We can decide to reintroduce a forced conversion to HTTPHeaderDict in
+urllib3 3.0 if the above issues are fixed.
+---
+ changelog/3343.bugfix.rst     | 1 +
+ src/urllib3/connectionpool.py | 4 ++--
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+ create mode 100644 changelog/3343.bugfix.rst
+
+diff --git a/changelog/3343.bugfix.rst b/changelog/3343.bugfix.rst
+new file mode 100644
+index 0000000000..4f2df9e7a4
+--- /dev/null
++++ b/changelog/3343.bugfix.rst
+@@ -0,0 +1 @@
++Fixed ``HTTPConnectionPool.urlopen`` to stop automatically casting non-proxy headers to ``HTTPHeaderDict``. This change was premature as it did not apply to proxy headers and ``HTTPHeaderDict`` does not handle byte header values correctly yet.
+diff --git a/src/urllib3/connectionpool.py b/src/urllib3/connectionpool.py
+index 1036f0d718..bd58ff14dd 100644
+--- a/src/urllib3/connectionpool.py
++++ b/src/urllib3/connectionpool.py
+@@ -751,8 +751,8 @@ def urlopen(  # type: ignore[override]
+         # have to copy the headers dict so we can safely change it without those
+         # changes being reflected in anyone else's copy.
+         if not http_tunnel_required:
+-            headers = HTTPHeaderDict(headers)
+-            headers.update(self.proxy_headers)
++            headers = headers.copy()  # type: ignore[attr-defined]
++            headers.update(self.proxy_headers)  # type: ignore[union-attr]
+ 
+         # Must keep the exception bound to a separate variable or else Python 3
+         # complains about UnboundLocalError.

diff --git a/dev-python/urllib3/urllib3-2.2.0.ebuild b/dev-python/urllib3/urllib3-2.2.0-r1.ebuild
similarity index 95%
rename from dev-python/urllib3/urllib3-2.2.0.ebuild
rename to dev-python/urllib3/urllib3-2.2.0-r1.ebuild
index eb55415eb52a..bdcc50c7b073 100644
--- a/dev-python/urllib3/urllib3-2.2.0.ebuild
+++ b/dev-python/urllib3/urllib3-2.2.0-r1.ebuild
@@ -66,6 +66,11 @@ BDEPEND="
 "
 
 src_prepare() {
+	local PATCHES=(
+		# https://github.com/urllib3/urllib3/commit/49b2ddaf07ec9ef65ef12d0218117f20e739ee6e
+		"${FILESDIR}/${P}-revert.patch"
+	)
+
 	# upstream considers 0.5 s to be "long" for a timeout
 	# we get tons of test failures on *fast* systems because of that
 	sed -i -e '/LONG_TIMEOUT/s:0.5:5:' test/__init__.py || die


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-16 17:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-16 17:16 [gentoo-commits] repo/gentoo:master commit in: dev-python/urllib3/, dev-python/urllib3/files/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2021-03-15  8:52 Michał Górny
2020-12-23  2:03 Sam James
2018-07-14 10:40 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox