summaryrefslogtreecommitdiff
path: root/dev-python/httpx
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-10-05 13:19:37 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-10-05 13:19:37 +0100
commitd03ec6c0e9c1683a824ce77667440dcb4a13974e (patch)
treea6d1dcba1ebf79b5ab9a81588f2e3dd4ca16cb57 /dev-python/httpx
parent315f94518df5e89b0990f56d7200f52d67aeec51 (diff)
gentoo auto-resync : 05:10:2022 - 13:19:37
Diffstat (limited to 'dev-python/httpx')
-rw-r--r--dev-python/httpx/Manifest3
-rw-r--r--dev-python/httpx/files/httpx-0.23.0-cgi.patch68
-rw-r--r--dev-python/httpx/httpx-0.23.0-r1.ebuild (renamed from dev-python/httpx/httpx-0.23.0.ebuild)4
3 files changed, 74 insertions, 1 deletions
diff --git a/dev-python/httpx/Manifest b/dev-python/httpx/Manifest
index b6650a0114b8..4e406469241e 100644
--- a/dev-python/httpx/Manifest
+++ b/dev-python/httpx/Manifest
@@ -1,3 +1,4 @@
+AUX httpx-0.23.0-cgi.patch 2002 BLAKE2B 3f7c7e2a85d812d1a6cbd96a21b5d9716581b59528f651facd1c1b4f4b692aef24c1e8ef8d90315dd34dfbb84914c2cf23dce95499f401ad333632d15a6bfc0b SHA512 26c02d8c7bd6c50c72533e114377950d3f58a1ebe23193d8d6424c03c5f0efafb2f81dc155b5c16572dacd71bb2ad2aaea19816982a61ee19f2b531192796324
DIST httpx-0.23.0.gh.tar.gz 2160686 BLAKE2B 036c66b2c3f743cd069716297f331f0d75043a98180b9db3e156c5692ae8bf9c68d1db87169953a7f44aaf7ee8554d0166f70b508f77b7ff4b0ebc0500bc02ad SHA512 3cfdf2b3b2f15967a1eec0be05ed947c5e18a46576b68a9cbfd5147dfd4736cb7c389f5431732b93f3a11f3ec6c6f25f7cbb3d96d845f00b58e2b8dae047c1d5
-EBUILD httpx-0.23.0.ebuild 2188 BLAKE2B c7ec73ae670465bdeac0d1b81543aca3d7652f54bd92fe80be7a158bec35a817764c3cee406fa8aab50f98869ff59f8321a19c1141f1eff0512b3579fede6e87 SHA512 9d400fe37329144efee52f6ad9f23317e5290ce0a0489a9cbb8573a88decc9aaf5a1f30233a7f0ffb0d122c59d764070c0b19951ace5473a3bba1b3da9ba666a
+EBUILD httpx-0.23.0-r1.ebuild 2240 BLAKE2B 008a5e77c120facb896e0d0249d07cd98ece5e03b27df435d6f85f510e699d592d19386a6aaf848b5fb7f9b3108fd8a59dea4e8cb914ed9604f7d93254502f69 SHA512 2d7190ff15fb361f7200f09bcabe8fa223b0cd40bfb27a3b19ff43eee2c0fc22a2b7f9ed36819c0f404d5d10fb75c3ba534188ba4d721b0240d78665d1a66766
MISC metadata.xml 518 BLAKE2B 063b5b95529cd5a31aac83998c0acbdfef208c34e931c96ae8ee767a326301a597a8297514b5c97bef2b3b706b8938d38c0e5f5d752307a9dd06984792c799a2 SHA512 3a29dffa0f951255a67468b28917590d4108ca12e14af03bfddef80f6d48e266fcccdd991e778ab9e267c0bc76ff0017e07905c1f2f45dc440a9af89f6cae6aa
diff --git a/dev-python/httpx/files/httpx-0.23.0-cgi.patch b/dev-python/httpx/files/httpx-0.23.0-cgi.patch
new file mode 100644
index 000000000000..ba9a7aebda2d
--- /dev/null
+++ b/dev-python/httpx/files/httpx-0.23.0-cgi.patch
@@ -0,0 +1,68 @@
+From f13ab4d288d0b790f6f1c515a6c0ea45e9615748 Mon Sep 17 00:00:00 2001
+From: Florimond Manca <florimond.manca@protonmail.com>
+Date: Thu, 25 Aug 2022 12:23:04 +0200
+Subject: [PATCH] Replace cgi which will be deprecated in Python 3.11 (#2309)
+
+* Replace cgi which will be deprecated in Python 3.11
+
+* Update httpx/_utils.py
+---
+ httpx/_models.py | 8 ++------
+ httpx/_utils.py | 9 +++++++++
+ 2 files changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/httpx/_models.py b/httpx/_models.py
+index fd1d7fe9a..7a3b5885d 100644
+--- a/httpx/_models.py
++++ b/httpx/_models.py
+@@ -1,4 +1,3 @@
+-import cgi
+ import datetime
+ import email.message
+ import json as jsonlib
+@@ -47,6 +46,7 @@
+ normalize_header_key,
+ normalize_header_value,
+ obfuscate_sensitive_headers,
++ parse_content_type_charset,
+ parse_header_links,
+ )
+
+@@ -608,11 +608,7 @@ def charset_encoding(self) -> typing.Optional[str]:
+ if content_type is None:
+ return None
+
+- _, params = cgi.parse_header(content_type)
+- if "charset" not in params:
+- return None
+-
+- return params["charset"].strip("'\"")
++ return parse_content_type_charset(content_type)
+
+ def _get_content_decoder(self) -> ContentDecoder:
+ """
+diff --git a/httpx/_utils.py b/httpx/_utils.py
+index e01c050df..ecce4f417 100644
+--- a/httpx/_utils.py
++++ b/httpx/_utils.py
+@@ -1,4 +1,5 @@
+ import codecs
++import email.message
+ import logging
+ import mimetypes
+ import netrc
+@@ -209,6 +210,14 @@ def parse_header_links(value: str) -> typing.List[typing.Dict[str, str]]:
+ return links
+
+
++def parse_content_type_charset(content_type: str) -> typing.Optional[str]:
++ # We used to use `cgi.parse_header()` here, but `cgi` became a dead battery.
++ # See: https://peps.python.org/pep-0594/#cgi
++ msg = email.message.Message()
++ msg["content-type"] = content_type
++ return msg.get_content_charset(failobj=None)
++
++
+ SENSITIVE_HEADERS = {"authorization", "proxy-authorization"}
+
+
diff --git a/dev-python/httpx/httpx-0.23.0.ebuild b/dev-python/httpx/httpx-0.23.0-r1.ebuild
index f63c41c27f79..674754d2796c 100644
--- a/dev-python/httpx/httpx-0.23.0.ebuild
+++ b/dev-python/httpx/httpx-0.23.0-r1.ebuild
@@ -57,6 +57,10 @@ BDEPEND="
distutils_enable_tests pytest
src_prepare() {
+ local PATCHES=(
+ "${FILESDIR}"/${P}-cgi.patch
+ )
+
# unpin deps
sed -i -e 's:==[0-9.*]\+::' -e 's:,<[0-9.]\+::' setup.py || die
if ! use cli; then