From d228f661892a9e55a86f00c2c14625490631d797 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 16 Feb 2024 23:37:06 +0000 Subject: gentoo auto-resync : 16:02:2024 - 23:37:06 --- dev-python/urllib3/Manifest | 4 +- .../urllib3/files/urllib3-2.2.0-pytest-8.patch | 112 +++++++++++++++++++++ .../urllib3/files/urllib3-2.2.0-revert.patch | 42 ++++++++ dev-python/urllib3/urllib3-2.2.0-r1.ebuild | 99 ++++++++++++++++++ dev-python/urllib3/urllib3-2.2.0.ebuild | 92 ----------------- 5 files changed, 256 insertions(+), 93 deletions(-) create mode 100644 dev-python/urllib3/files/urllib3-2.2.0-pytest-8.patch create mode 100644 dev-python/urllib3/files/urllib3-2.2.0-revert.patch create mode 100644 dev-python/urllib3/urllib3-2.2.0-r1.ebuild delete mode 100644 dev-python/urllib3/urllib3-2.2.0.ebuild (limited to 'dev-python/urllib3') diff --git a/dev-python/urllib3/Manifest b/dev-python/urllib3/Manifest index 258c04b5d817..830e7ea2fa63 100644 --- a/dev-python/urllib3/Manifest +++ b/dev-python/urllib3/Manifest @@ -1,3 +1,5 @@ +AUX urllib3-2.2.0-pytest-8.patch 4439 BLAKE2B 5f67936952395f46e5732579a9e8bbb051d76f136f93912c3b355b7dfe15df6490c7bca702dc74184e33dc729f31aa73297729075bd2d28d895473998e5506b7 SHA512 a8249f76754df1b94e66cef679622734968e02911607ee5b86386b4f3e98a3d90c8b4410d9ec54da994695b0bca30a51e84ea923d36634c0e6ca1e785044e876 +AUX urllib3-2.2.0-revert.patch 1984 BLAKE2B 8cd784e62d797e2bb256ac0a4f64b6e738113486bc3a691823f7e0376662b26d05218d40bc71cc9c6a8641868457026992a3e2b7233b6329a090af662a3cb799 SHA512 c1a33b9ae738cf9269224937bd8531e4bb97b6f8cf9a21da4598c4ae3fa5eb470d0f4d54dbea2706f9fdab6073151cb7607170204de4e8ac07a4efa930693ac3 DIST hypercorn-d1719f8c1570cbd8e6a3719ffdb14a4d72880abb.gh.tar.gz 156216 BLAKE2B fcb5f49653401e6e4079e1c770d3cd407602d4d6764437b735bd4ec04191dec59cdc930822fa2aff726ee25cddd0f71fd457dedf31026bff1da121d93af8b768 SHA512 62d6787d88a2e716f0ac04fc49f6cdc586e473a660ee754ff66961922ae78bcc75d1f78b091e78557dd60f006e8e480114738c7b4ff71beac804e4fc9603240b DIST urllib3-1.26.18.tar.gz 305687 BLAKE2B f2f673761a8d80eee715a8726ba36ab6b09800fd4a4f03f27438553c36072e2abb5ff26cff71dcf30fd114f4d28c4ad9907533965b83c8a0581d3d4661904b70 SHA512 c89e93a032bf6b11375c06ef7c5abc1868f93e7655cfdca09e9bd939ad415d206ea159fe151ecd2e5f725e0e18a831c7a5382ad01dbc32264154fc8af7aec156 DIST urllib3-2.0.7.tar.gz 282546 BLAKE2B d4fbb9e1d0b6d1f3c3d71efc3fc479c7b1c49f87ca849c387701fb0c8b4124082de6d83d958c8b2afc225a84b80e7665df857e7b0918ba50e4ad1431f8facc4d SHA512 ca21dd330cfc7f53e6f00a92be1df1d24acbe61b6ca31c52a272dccd6f50d1bb797eece9132860adc84c21a9bebc3030a12816081451fcb8384c11a6cd2d1e8b @@ -6,5 +8,5 @@ DIST urllib3-2.2.0.tar.gz 287152 BLAKE2B 126949265c6558e8743f8e2e05e80fd211845c6 EBUILD urllib3-1.26.18.ebuild 2312 BLAKE2B 9c1155aa93102ea0b118b2980142c07b9bb98b08ebb779861ecf182ffcedd542bb816e1f9a1976cdd09760ad2d0c931bc1d4fe8050ab2a93d9ded82ba0b4966d SHA512 9c4d385c148f5ba5e1a2f0792e1059aece3aff14baf2236edeee36e31fc6f83ff7b6401b6100d3d3f35ad631eb2bbbe4eec95e31dfb0948e2a4833c38c234a73 EBUILD urllib3-2.0.7.ebuild 3297 BLAKE2B aa93e50875380bda0b91543451be2d3425d0ab8c77650a9c84fff90c889ddf812ae66b78fed95ef820a68a510eb952716fea459f7dcef8b41db8156e0b5d3cb0 SHA512 790d5c7d1fb6838be75ecb3802cda5975ffe5a45c57cd67d6fe264de4bf47b9511b897233f8057298721665366f1da5bb89fbb58bf255b4659b8afc4f95224d4 EBUILD urllib3-2.1.0.ebuild 3297 BLAKE2B aa93e50875380bda0b91543451be2d3425d0ab8c77650a9c84fff90c889ddf812ae66b78fed95ef820a68a510eb952716fea459f7dcef8b41db8156e0b5d3cb0 SHA512 790d5c7d1fb6838be75ecb3802cda5975ffe5a45c57cd67d6fe264de4bf47b9511b897233f8057298721665366f1da5bb89fbb58bf255b4659b8afc4f95224d4 -EBUILD urllib3-2.2.0.ebuild 2849 BLAKE2B 03b8677acd813b4be94e3ef766d19afb529ca38be7f8e09c61870851de46b66bd1b1ccd0ef89e392926d09f6bd819877e82d9917c503a2915f45250e24cf8be4 SHA512 8d3f7edb37096aadabbdf2cf94d6cec47e9a344bf1cc4ca500cdf04230995febcf857611ce91c145e88a0b52b9c9476c5fa8ee54464b7ef25d408db2ddb6c429 +EBUILD urllib3-2.2.0-r1.ebuild 3114 BLAKE2B 7c6f0f27381c8058dc4bf97b4fc60517fd612a6b6d54b76ee81c8d4f0b99cdaf8848ed84c097f4b77c9566ea68457ca8c003f3e6ac9b53cf75e770c16d38bacf SHA512 8491d260e6b7f32646e4beef876dd481ab5d6843b96ddd3221bc3d500d8aee9417e2ed82d0fdf1f0e31fe4ccb9d404ff2eead22651cc88102808de10ed3d04a6 MISC metadata.xml 449 BLAKE2B 45df5a0e80d7b229058be52fd8feb3ba2efe8d981b5b34216e4b9cb35d332588c4b3efade8e8d06bdf1f13159dfcd937458e5cf4d0cea5e07b6c1011cc8592cb SHA512 312b41031a9cbf6341f537fef94137420ca49ab609e7d4c325a998e328be415b381aa50e7b5600483d1a7583b72675a044b5dd80cb84a52539ab23271f1b096c diff --git a/dev-python/urllib3/files/urllib3-2.2.0-pytest-8.patch b/dev-python/urllib3/files/urllib3-2.2.0-pytest-8.patch new file mode 100644 index 000000000000..9baa3379a7c9 --- /dev/null +++ b/dev-python/urllib3/files/urllib3-2.2.0-pytest-8.patch @@ -0,0 +1,112 @@ +From aa8d3dd2535cc125e123e5c2bca38738d6864b2a Mon Sep 17 00:00:00 2001 +From: Ruben Laguna +Date: Mon, 5 Feb 2024 15:29:35 +0100 +Subject: [PATCH] Fix ssl_version tests for upcoming migration to pytest 8 + +--- + dev-requirements.txt | 2 +- + test/contrib/test_pyopenssl.py | 1 - + test/with_dummyserver/test_https.py | 35 ++++++++++++++++++++--------- + 3 files changed, 26 insertions(+), 12 deletions(-) + +diff --git a/test/contrib/test_pyopenssl.py b/test/contrib/test_pyopenssl.py +index b4799ce802..eaca77ba6f 100644 +--- a/test/contrib/test_pyopenssl.py ++++ b/test/contrib/test_pyopenssl.py +@@ -38,7 +38,6 @@ def teardown_module() -> None: + from ..test_ssl import TestSSL # noqa: E402, F401 + from ..test_util import TestUtilSSL # noqa: E402, F401 + from ..with_dummyserver.test_https import ( # noqa: E402, F401 +- TestHTTPS, + TestHTTPS_IPV4SAN, + TestHTTPS_IPV6SAN, + TestHTTPS_TLSv1, +diff --git a/test/with_dummyserver/test_https.py b/test/with_dummyserver/test_https.py +index aa22f11879..b8353d758b 100644 +--- a/test/with_dummyserver/test_https.py ++++ b/test/with_dummyserver/test_https.py +@@ -65,7 +65,7 @@ + CLIENT_CERT = CLIENT_INTERMEDIATE_PEM + + +-class TestHTTPS(HTTPSHypercornDummyServerTestCase): ++class BaseTestHTTPS(HTTPSHypercornDummyServerTestCase): + tls_protocol_name: str | None = None + + def tls_protocol_not_default(self) -> bool: +@@ -83,11 +83,17 @@ def tls_version(self) -> ssl.TLSVersion: + def ssl_version(self) -> int: + if self.tls_protocol_name is None: + return pytest.skip("Skipping base test class") +- attribute = f"PROTOCOL_{self.tls_protocol_name.replace('.', '_')}" +- ssl_version = getattr(ssl, attribute, None) +- if ssl_version is None: +- return pytest.skip(f"ssl.{attribute} isn't available") +- return ssl_version # type: ignore[no-any-return] ++ ++ if self.tls_protocol_name == "TLSv1.3" and ssl.HAS_TLSv1_3: ++ return ssl.PROTOCOL_TLS_CLIENT ++ if self.tls_protocol_name == "TLSv1.2" and ssl.HAS_TLSv1_2: ++ return ssl.PROTOCOL_TLSv1_2 ++ if self.tls_protocol_name == "TLSv1.1" and ssl.HAS_TLSv1_1: ++ return ssl.PROTOCOL_TLSv1_1 ++ if self.tls_protocol_name == "TLSv1" and ssl.HAS_TLSv1: ++ return ssl.PROTOCOL_TLSv1 ++ else: ++ return pytest.skip(f"{self.tls_protocol_name} isn't available") + + @classmethod + def setup_class(cls) -> None: +@@ -797,6 +803,10 @@ def test_tls_protocol_name_of_socket(self) -> None: + def test_ssl_version_is_deprecated(self) -> None: + if self.tls_protocol_name is None: + pytest.skip("Skipping base test class") ++ if self.ssl_version() == ssl.PROTOCOL_TLS_CLIENT: ++ pytest.skip( ++ "Skipping because ssl_version=ssl.PROTOCOL_TLS_CLIENT is not deprecated" ++ ) + + with HTTPSConnectionPool( + self.host, self.port, ca_certs=DEFAULT_CA, ssl_version=self.ssl_version() +@@ -964,6 +974,11 @@ def test_default_ssl_context_ssl_min_max_versions(self) -> None: + assert ctx.maximum_version == expected_maximum_version + + def test_ssl_context_ssl_version_uses_ssl_min_max_versions(self) -> None: ++ if self.ssl_version() == ssl.PROTOCOL_TLS_CLIENT: ++ pytest.skip( ++ "Skipping because ssl_version=ssl.PROTOCOL_TLS_CLIENT is not deprecated" ++ ) ++ + with pytest.warns( + DeprecationWarning, + match=r"'ssl_version' option is deprecated and will be removed in " +@@ -977,25 +992,25 @@ def test_ssl_context_ssl_version_uses_ssl_min_max_versions(self) -> None: + + + @pytest.mark.usefixtures("requires_tlsv1") +-class TestHTTPS_TLSv1(TestHTTPS): ++class TestHTTPS_TLSv1(BaseTestHTTPS): + tls_protocol_name = "TLSv1" + certs = TLSv1_CERTS + + + @pytest.mark.usefixtures("requires_tlsv1_1") +-class TestHTTPS_TLSv1_1(TestHTTPS): ++class TestHTTPS_TLSv1_1(BaseTestHTTPS): + tls_protocol_name = "TLSv1.1" + certs = TLSv1_1_CERTS + + + @pytest.mark.usefixtures("requires_tlsv1_2") +-class TestHTTPS_TLSv1_2(TestHTTPS): ++class TestHTTPS_TLSv1_2(BaseTestHTTPS): + tls_protocol_name = "TLSv1.2" + certs = TLSv1_2_CERTS + + + @pytest.mark.usefixtures("requires_tlsv1_3") +-class TestHTTPS_TLSv1_3(TestHTTPS): ++class TestHTTPS_TLSv1_3(BaseTestHTTPS): + tls_protocol_name = "TLSv1.3" + certs = TLSv1_3_CERTS + 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 +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-r1.ebuild b/dev-python/urllib3/urllib3-2.2.0-r1.ebuild new file mode 100644 index 000000000000..c8abe317fa22 --- /dev/null +++ b/dev-python/urllib3/urllib3-2.2.0-r1.ebuild @@ -0,0 +1,99 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# please keep this ebuild at EAPI 8 -- sys-apps/portage dep +EAPI=8 + +DISTUTILS_USE_PEP517=hatchling +PYTHON_TESTED=( python3_{10..12} pypy3 ) +PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" ) +PYTHON_REQ_USE="ssl(+)" + +inherit distutils-r1 pypi + +# The package has a test dependency on their own hypercorn fork. +HYPERCORN_COMMIT=d1719f8c1570cbd8e6a3719ffdb14a4d72880abb +DESCRIPTION="HTTP library with thread-safe connection pooling, file post, and more" +HOMEPAGE=" + https://github.com/urllib3/urllib3/ + https://pypi.org/project/urllib3/ +" +SRC_URI+=" + test? ( + https://github.com/urllib3/hypercorn/archive/${HYPERCORN_COMMIT}.tar.gz + -> hypercorn-${HYPERCORN_COMMIT}.gh.tar.gz + ) +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~riscv" +IUSE="brotli http2 test zstd" +RESTRICT="!test? ( test )" + +# [secure] extra is deprecated and slated for removal, we don't need it: +# https://github.com/urllib3/urllib3/issues/2680 +RDEPEND=" + >=dev-python/PySocks-1.5.8[${PYTHON_USEDEP}] + =dev-python/brotlicffi-0.8.0[${PYTHON_USEDEP}] ) + http2? ( + =dev-python/h2-4[${PYTHON_USEDEP}] + ) + zstd? ( >=dev-python/zstandard-0.18.0[${PYTHON_USEDEP}] ) +" +BDEPEND=" + test? ( + $(python_gen_cond_dep " + ${RDEPEND} + dev-python/brotlicffi[\${PYTHON_USEDEP}] + dev-python/freezegun[\${PYTHON_USEDEP}] + dev-python/h2[\${PYTHON_USEDEP}] + dev-python/httpx[\${PYTHON_USEDEP}] + dev-python/pytest[\${PYTHON_USEDEP}] + dev-python/pytest-rerunfailures[\${PYTHON_USEDEP}] + dev-python/pytest-timeout[\${PYTHON_USEDEP}] + dev-python/pytest-xdist[\${PYTHON_USEDEP}] + dev-python/quart[\${PYTHON_USEDEP}] + dev-python/quart-trio[\${PYTHON_USEDEP}] + dev-python/trio[\${PYTHON_USEDEP}] + >=dev-python/tornado-4.2.1[\${PYTHON_USEDEP}] + >=dev-python/trustme-0.5.3[\${PYTHON_USEDEP}] + >=dev-python/zstandard-0.18.0[\${PYTHON_USEDEP}] + " "${PYTHON_TESTED[@]}") + ) +" + +src_prepare() { + local PATCHES=( + # https://github.com/urllib3/urllib3/commit/49b2ddaf07ec9ef65ef12d0218117f20e739ee6e + "${FILESDIR}/${P}-revert.patch" + # https://github.com/urllib3/urllib3/commit/aa8d3dd2535cc125e123e5c2bca38738d6864b2a + "${FILESDIR}/${P}-pytest-8.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 + distutils-r1_src_prepare +} + +python_test() { + local -x PYTHONPATH=${WORKDIR}/hypercorn-${HYPERCORN_COMMIT}/src + local -x CI=1 + if ! has "${EPYTHON}" "${PYTHON_TESTED[@]/_/.}"; then + einfo "Skipping tests on ${EPYTHON}" + return + fi + + local EPYTEST_DESELECT=( + # TODO: timeouts + test/contrib/test_pyopenssl.py::TestSocketClosing::test_timeout_errors_cause_retries + test/with_dummyserver/test_socketlevel.py::TestSocketClosing::test_timeout_errors_cause_retries + ) + + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 + local EPYTEST_XDIST=1 + epytest -p timeout -p rerunfailures --reruns=10 --reruns-delay=2 +} diff --git a/dev-python/urllib3/urllib3-2.2.0.ebuild b/dev-python/urllib3/urllib3-2.2.0.ebuild deleted file mode 100644 index eb55415eb52a..000000000000 --- a/dev-python/urllib3/urllib3-2.2.0.ebuild +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# please keep this ebuild at EAPI 8 -- sys-apps/portage dep -EAPI=8 - -DISTUTILS_USE_PEP517=hatchling -PYTHON_TESTED=( python3_{10..12} pypy3 ) -PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" ) -PYTHON_REQ_USE="ssl(+)" - -inherit distutils-r1 pypi - -# The package has a test dependency on their own hypercorn fork. -HYPERCORN_COMMIT=d1719f8c1570cbd8e6a3719ffdb14a4d72880abb -DESCRIPTION="HTTP library with thread-safe connection pooling, file post, and more" -HOMEPAGE=" - https://github.com/urllib3/urllib3/ - https://pypi.org/project/urllib3/ -" -SRC_URI+=" - test? ( - https://github.com/urllib3/hypercorn/archive/${HYPERCORN_COMMIT}.tar.gz - -> hypercorn-${HYPERCORN_COMMIT}.gh.tar.gz - ) -" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~riscv" -IUSE="brotli http2 test zstd" -RESTRICT="!test? ( test )" - -# [secure] extra is deprecated and slated for removal, we don't need it: -# https://github.com/urllib3/urllib3/issues/2680 -RDEPEND=" - >=dev-python/PySocks-1.5.8[${PYTHON_USEDEP}] - =dev-python/brotlicffi-0.8.0[${PYTHON_USEDEP}] ) - http2? ( - =dev-python/h2-4[${PYTHON_USEDEP}] - ) - zstd? ( >=dev-python/zstandard-0.18.0[${PYTHON_USEDEP}] ) -" -BDEPEND=" - test? ( - $(python_gen_cond_dep " - ${RDEPEND} - dev-python/brotlicffi[\${PYTHON_USEDEP}] - dev-python/freezegun[\${PYTHON_USEDEP}] - dev-python/h2[\${PYTHON_USEDEP}] - dev-python/httpx[\${PYTHON_USEDEP}] - dev-python/pytest[\${PYTHON_USEDEP}] - dev-python/pytest-rerunfailures[\${PYTHON_USEDEP}] - dev-python/pytest-timeout[\${PYTHON_USEDEP}] - dev-python/pytest-xdist[\${PYTHON_USEDEP}] - dev-python/quart[\${PYTHON_USEDEP}] - dev-python/quart-trio[\${PYTHON_USEDEP}] - dev-python/trio[\${PYTHON_USEDEP}] - >=dev-python/tornado-4.2.1[\${PYTHON_USEDEP}] - >=dev-python/trustme-0.5.3[\${PYTHON_USEDEP}] - >=dev-python/zstandard-0.18.0[\${PYTHON_USEDEP}] - " "${PYTHON_TESTED[@]}") - ) -" - -src_prepare() { - # 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 - distutils-r1_src_prepare -} - -python_test() { - local -x PYTHONPATH=${WORKDIR}/hypercorn-${HYPERCORN_COMMIT}/src - local -x CI=1 - if ! has "${EPYTHON}" "${PYTHON_TESTED[@]/_/.}"; then - einfo "Skipping tests on ${EPYTHON}" - return - fi - - local EPYTEST_DESELECT=( - # TODO: timeouts - test/contrib/test_pyopenssl.py::TestSocketClosing::test_timeout_errors_cause_retries - test/with_dummyserver/test_socketlevel.py::TestSocketClosing::test_timeout_errors_cause_retries - ) - - local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 - local EPYTEST_XDIST=1 - epytest -p timeout -p rerunfailures --reruns=10 --reruns-delay=2 -} -- cgit v1.2.3