diff options
author | Michał Górny <mgorny@gentoo.org> | 2023-05-21 06:32:26 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2023-05-21 06:55:24 +0200 |
commit | 77ab25ab03fa3d51d94cd5a48a6a6f30a1205391 (patch) | |
tree | 8fe2355edd3cb6df6243b2967fe2f48049b0b552 /dev-python/requests-unixsocket | |
parent | dev-python/requests-unixsocket: Require <dev-python/urllib3-2 (diff) | |
download | gentoo-77ab25ab03fa3d51d94cd5a48a6a6f30a1205391.tar.gz gentoo-77ab25ab03fa3d51d94cd5a48a6a6f30a1205391.tar.bz2 gentoo-77ab25ab03fa3d51d94cd5a48a6a6f30a1205391.zip |
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@gentoo.org>
Diffstat (limited to 'dev-python/requests-unixsocket')
-rw-r--r-- | dev-python/requests-unixsocket/files/requests-unixsocket-0.3.0-urllib3-2.patch | 45 | ||||
-rw-r--r-- | dev-python/requests-unixsocket/requests-unixsocket-0.3.0-r4.ebuild | 38 |
2 files changed, 83 insertions, 0 deletions
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 |