commit:     3d1e085725f9968e622a29d985c5e18c1ab25efc
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 26 06:47:23 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 26 06:47:48 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d1e0857

dev-python/requests: unpin chardet

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../requests-2.28.0-drop-dependency-warnings.patch | 21 ++++++
 .../files/requests-2.28.0-unpin-chardet.patch      | 37 +++++++++++
 dev-python/requests/requests-2.28.0-r2.ebuild      | 74 ++++++++++++++++++++++
 3 files changed, 132 insertions(+)

diff --git 
a/dev-python/requests/files/requests-2.28.0-drop-dependency-warnings.patch 
b/dev-python/requests/files/requests-2.28.0-drop-dependency-warnings.patch
new file mode 100644
index 000000000000..ec3634966a07
--- /dev/null
+++ b/dev-python/requests/files/requests-2.28.0-drop-dependency-warnings.patch
@@ -0,0 +1,21 @@
+Minimal patch to avoid often rebasing.
+
+We already have tools to try check for these (`pip check` obviously, but also
+app-portage/gpyutils provides gpy-verify-deps).
+--- a/requests/__init__.py
++++ b/requests/__init__.py
+@@ -106,13 +106,7 @@ try:
+         urllib3.__version__, chardet_version, charset_normalizer_version
+     )
+ except (AssertionError, ValueError):
+-    warnings.warn(
+-        "urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a 
supported "
+-        "version!".format(
+-            urllib3.__version__, chardet_version, charset_normalizer_version
+-        ),
+-        RequestsDependencyWarning,
+-    )
++    pass
+ 
+ # Attempt to enable urllib3's fallback for SNI support
+ # if the standard library doesn't support SNI or the

diff --git a/dev-python/requests/files/requests-2.28.0-unpin-chardet.patch 
b/dev-python/requests/files/requests-2.28.0-unpin-chardet.patch
new file mode 100644
index 000000000000..bd0451daaf13
--- /dev/null
+++ b/dev-python/requests/files/requests-2.28.0-unpin-chardet.patch
@@ -0,0 +1,37 @@
+https://github.com/psf/requests/pull/6179
+
+From 09483bae4f56e4f4c227e2d25ee920c538271feb Mon Sep 17 00:00:00 2001
+From: Wong Hoi Sing Edison <hswon...@pantarei-design.com>
+Date: Sun, 26 Jun 2022 12:18:42 +0800
+Subject: [PATCH] Update Dependency with `chardet>=3.0.2,<6`
+
+https://github.com/chardet/chardet/releases/tag/5.0.0 was released on
+2022-06-25 with remove of Python 3.6 support, which also align with our
+Python > 3.6 requirement.
+
+Signed-off-by: Wong Hoi Sing Edison <hswon...@pantarei-design.com>
+--- a/requests/__init__.py
++++ b/requests/__init__.py
+@@ -75,8 +75,8 @@ def check_compatibility(urllib3_version, chardet_version, 
charset_normalizer_ver
+     if chardet_version:
+         major, minor, patch = chardet_version.split(".")[:3]
+         major, minor, patch = int(major), int(minor), int(patch)
+-        # chardet_version >= 3.0.2, < 5.0.0
+-        assert (3, 0, 2) <= (major, minor, patch) < (5, 0, 0)
++        # chardet_version >= 3.0.2, < 6.0.0
++        assert (3, 0, 2) <= (major, minor, patch) < (6, 0, 0)
+     elif charset_normalizer_version:
+         major, minor, patch = charset_normalizer_version.split(".")[:3]
+         major, minor, patch = int(major), int(minor), int(patch)
+--- a/setup.py
++++ b/setup.py
+@@ -123,7 +123,7 @@ def run_tests(self):
+     extras_require={
+         "security": [],
+         "socks": ["PySocks>=1.5.6, !=1.5.7"],
+-        "use_chardet_on_py3": ["chardet>=3.0.2,<5"],
++        "use_chardet_on_py3": ["chardet>=3.0.2,<6"],
+     },
+     project_urls={
+         "Documentation": "https://requests.readthedocs.io";,
+

diff --git a/dev-python/requests/requests-2.28.0-r2.ebuild 
b/dev-python/requests/requests-2.28.0-r2.ebuild
new file mode 100644
index 000000000000..c3c23c38db26
--- /dev/null
+++ b/dev-python/requests/requests-2.28.0-r2.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# please keep this ebuild at EAPI 7 -- sys-apps/portage dep
+EAPI=7
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{8..11} pypy3 )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1
+
+DESCRIPTION="HTTP library for human beings"
+HOMEPAGE="
+       https://requests.readthedocs.io/
+       https://github.com/psf/requests/
+       https://pypi.org/project/requests/
+"
+SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+IUSE="socks5"
+
+RDEPEND="
+       >=dev-python/certifi-2017.4.17[${PYTHON_USEDEP}]
+       dev-python/charset_normalizer[${PYTHON_USEDEP}]
+       <dev-python/idna-4[${PYTHON_USEDEP}]
+       <dev-python/urllib3-1.27[${PYTHON_USEDEP}]
+       socks5? ( >=dev-python/PySocks-1.5.6[${PYTHON_USEDEP}] )
+"
+
+BDEPEND="
+       test? (
+               dev-python/pytest-httpbin[${PYTHON_USEDEP}]
+               dev-python/pytest-mock[${PYTHON_USEDEP}]
+               >=dev-python/PySocks-1.5.6[${PYTHON_USEDEP}]
+               !alpha? ( !hppa? ( !ia64? (
+                       dev-python/trustme[${PYTHON_USEDEP}]
+               ) ) )
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.28.0-unpin-charset-normalizer.patch
+       "${FILESDIR}"/${PN}-2.28.0-unpin-chardet.patch
+       "${FILESDIR}"/${PN}-2.28.0-drop-dependency-warnings.patch
+)
+
+distutils_enable_tests pytest
+
+python_test() {
+       local EPYTEST_DESELECT=(
+               # Internet (doctests)
+               requests/__init__.py::requests
+               requests/api.py::requests.api.request
+               requests/models.py::requests.models.PreparedRequest
+               requests/sessions.py::requests.sessions.Session
+               # require IPv4 interface in 10.* range
+               tests/test_requests.py::TestTimeout::test_connect_timeout
+               tests/test_requests.py::TestTimeout::test_total_timeout_connect
+               # TODO: openssl?
+               tests/test_requests.py::TestRequests::test_pyopenssl_redirect
+       )
+
+       if ! has_version "dev-python/trustme[${PYTHON_USEDEP}]"; then
+               EPYTEST_DESELECT+=(
+                       
tests/test_requests.py::TestRequests::test_https_warnings
+               )
+       fi
+
+       epytest
+}

Reply via email to