public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-unixsocket/files/, dev-python/requests-unixsocket/
@ 2023-05-21  4:59 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2023-05-21  4:59 UTC (permalink / raw
  To: gentoo-commits

commit:     77ab25ab03fa3d51d94cd5a48a6a6f30a1205391
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 21 04:32:26 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 21 04:55:24 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77ab25ab

dev-python/requests-unixsocket: Fix urllib3-2.0* compatibility

Pull-Request: https://github.com/msabramo/requests-unixsocket/pull/69
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../requests-unixsocket-0.3.0-urllib3-2.patch      | 45 ++++++++++++++++++++++
 .../requests-unixsocket-0.3.0-r4.ebuild            | 38 ++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/dev-python/requests-unixsocket/files/requests-unixsocket-0.3.0-urllib3-2.patch b/dev-python/requests-unixsocket/files/requests-unixsocket-0.3.0-urllib3-2.patch
new file mode 100644
index 000000000000..3cbcd2dd59d3
--- /dev/null
+++ b/dev-python/requests-unixsocket/files/requests-unixsocket-0.3.0-urllib3-2.patch
@@ -0,0 +1,45 @@
+From 5a614f60e7b3639758a6b77691b4e0c0d6827e94 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Roukala=20=28n=C3=A9=20Peres=29?=
+ <martin.roukala@mupuf.org>
+Date: Fri, 5 May 2023 09:23:41 +0300
+Subject: [PATCH] Inherit HTTPConnection through urllib3.connection, not
+ httplib
+
+By inheriting from `urllib3.connection.HTTPConnection` (that inherits
+from `httplib.HTTPConnection` itself), we can adapt to the internal
+changes in urllib3 2.0 that added a `request()` method that is
+incompatible with httplib.HTTPConnection.request.
+
+This fixes the incompatibility between urllib3 2.0 and requests 1.26+,
+which was the first version that stopped vendoring urllib3.
+
+Reference: https://github.com/docker/docker-py/issues/3113#issuecomment-1531570788
+---
+ requests_unixsocket/adapters.py | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/requests_unixsocket/adapters.py b/requests_unixsocket/adapters.py
+index 83e1400..513c243 100644
+--- a/requests_unixsocket/adapters.py
++++ b/requests_unixsocket/adapters.py
+@@ -3,11 +3,6 @@
+ from requests.adapters import HTTPAdapter
+ from requests.compat import urlparse, unquote
+ 
+-try:
+-    import http.client as httplib
+-except ImportError:
+-    import httplib
+-
+ try:
+     from requests.packages import urllib3
+ except ImportError:
+@@ -16,7 +11,7 @@
+ 
+ # The following was adapted from some code from docker-py
+ # https://github.com/docker/docker-py/blob/master/docker/transport/unixconn.py
+-class UnixHTTPConnection(httplib.HTTPConnection, object):
++class UnixHTTPConnection(urllib3.connection.HTTPConnection, object):
+ 
+     def __init__(self, unix_socket_url, timeout=60):
+         """Create an HTTP connection to a unix domain socket

diff --git a/dev-python/requests-unixsocket/requests-unixsocket-0.3.0-r4.ebuild b/dev-python/requests-unixsocket/requests-unixsocket-0.3.0-r4.ebuild
new file mode 100644
index 000000000000..e9644e79aedd
--- /dev/null
+++ b/dev-python/requests-unixsocket/requests-unixsocket-0.3.0-r4.ebuild
@@ -0,0 +1,38 @@
+# Copyright 2020-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYPI_NO_NORMALIZE=1
+PYTHON_COMPAT=( python3_{9..11} pypy3 )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Use requests to talk HTTP via a UNIX domain socket"
+HOMEPAGE="
+	https://github.com/msabramo/requests-unixsocket/
+	https://pypi.org/project/requests-unixsocket/
+"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+
+RDEPEND="
+	dev-python/requests[${PYTHON_USEDEP}]
+	dev-python/urllib3[${PYTHON_USEDEP}]
+"
+BDEPEND="
+	dev-python/pbr[${PYTHON_USEDEP}]
+	test? (
+		dev-python/waitress[${PYTHON_USEDEP}]
+	)
+"
+
+PATCHES=(
+	# https://github.com/msabramo/requests-unixsocket/pull/69
+	"${FILESDIR}/${P}-urllib3-2.patch"
+)
+
+distutils_enable_tests pytest


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

* [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-unixsocket/files/, dev-python/requests-unixsocket/
@ 2024-06-15 13:47 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2024-06-15 13:47 UTC (permalink / raw
  To: gentoo-commits

commit:     0595d6be93229997ecfa9e1a29cc6dc571317862
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 15 13:41:12 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jun 15 13:47:28 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0595d6be

dev-python/requests-unixsocket: Fix compat with newer requests

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

 ...requests-unixsocket-0.3.0-requests-2.32.2.patch | 25 ++++++++++++++++++++++
 .../requests-unixsocket-0.3.0-r4.ebuild            |  5 ++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/dev-python/requests-unixsocket/files/requests-unixsocket-0.3.0-requests-2.32.2.patch b/dev-python/requests-unixsocket/files/requests-unixsocket-0.3.0-requests-2.32.2.patch
new file mode 100644
index 000000000000..eb7b8f5df7b3
--- /dev/null
+++ b/dev-python/requests-unixsocket/files/requests-unixsocket-0.3.0-requests-2.32.2.patch
@@ -0,0 +1,25 @@
+From 8b02ed531d8def03b4cf767e8a925be09db43dff Mon Sep 17 00:00:00 2001
+From: Simon Deziel <simon.deziel@canonical.com>
+Date: Wed, 22 May 2024 12:02:20 -0400
+Subject: [PATCH] adapters: fix for requests 2.32.2+
+
+Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
+---
+ requests_unixsocket/adapters.py | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/requests_unixsocket/adapters.py b/requests_unixsocket/adapters.py
+index 83e1400..c3c73cc 100644
+--- a/requests_unixsocket/adapters.py
++++ b/requests_unixsocket/adapters.py
+@@ -63,6 +63,10 @@ def __init__(self, timeout=60, pool_connections=25, *args, **kwargs):
+             pool_connections, dispose_func=lambda p: p.close()
+         )
+ 
++    # Fix for requests 2.32.2+: https://github.com/psf/requests/pull/6710
++    def get_connection_with_tls_context(self, request, verify, proxies=None, cert=None):
++        return self.get_connection(request.url, proxies)
++
+     def get_connection(self, url, proxies=None):
+         proxies = proxies or {}
+         proxy = proxies.get(urlparse(url.lower()).scheme)

diff --git a/dev-python/requests-unixsocket/requests-unixsocket-0.3.0-r4.ebuild b/dev-python/requests-unixsocket/requests-unixsocket-0.3.0-r4.ebuild
index 1af801834bff..fb11398447dc 100644
--- a/dev-python/requests-unixsocket/requests-unixsocket-0.3.0-r4.ebuild
+++ b/dev-python/requests-unixsocket/requests-unixsocket-0.3.0-r4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2020-2023 Gentoo Authors
+# Copyright 2020-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -10,6 +10,7 @@ PYTHON_COMPAT=( python3_{10..12} pypy3 )
 inherit distutils-r1 pypi
 
 DESCRIPTION="Use requests to talk HTTP via a UNIX domain socket"
+# TODO: replace with requests-unixsocket2?
 HOMEPAGE="
 	https://github.com/msabramo/requests-unixsocket/
 	https://pypi.org/project/requests-unixsocket/
@@ -33,6 +34,8 @@ BDEPEND="
 PATCHES=(
 	# https://github.com/msabramo/requests-unixsocket/pull/69
 	"${FILESDIR}/${P}-urllib3-2.patch"
+	# https://github.com/msabramo/requests-unixsocket/pull/72
+	"${FILESDIR}/${P}-requests-2.32.2.patch"
 )
 
 distutils_enable_tests pytest


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

end of thread, other threads:[~2024-06-15 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-15 13:47 [gentoo-commits] repo/gentoo:master commit in: dev-python/requests-unixsocket/files/, dev-python/requests-unixsocket/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2023-05-21  4:59 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