1 # Copyright 1999-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 # please keep this ebuild at EAPI 8 -- sys-apps/portage dep
7 DISTUTILS_USE_PEP517=setuptools
8 PYTHON_TESTED=( python3_{10..12} pypy3 )
9 PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" )
10 PYTHON_REQ_USE="ssl(+)"
12 inherit distutils-r1 pypi
14 DESCRIPTION="HTTP library with thread-safe connection pooling, file post, and more"
16 https://github.com/urllib3/urllib3/
17 https://pypi.org/project/urllib3/
22 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~ppc-macos ~x64-macos ~x64-solaris"
24 RESTRICT="!test? ( test )"
26 # dev-python/{pyopenssl,cryptography,idna,certifi} are optional runtime
27 # dependencies. Do not add them to RDEPEND. They should be unnecessary with
28 # modern versions of python (>= 3.2).
30 >=dev-python/PySocks-1.5.8[${PYTHON_USEDEP}]
31 <dev-python/PySocks-2.0[${PYTHON_USEDEP}]
32 dev-python/six[${PYTHON_USEDEP}]
33 brotli? ( dev-python/brotlicffi[${PYTHON_USEDEP}] )
37 $(python_gen_cond_dep "
39 dev-python/brotlicffi[\${PYTHON_USEDEP}]
40 dev-python/mock[\${PYTHON_USEDEP}]
41 dev-python/pytest[\${PYTHON_USEDEP}]
42 dev-python/pytest-freezegun[\${PYTHON_USEDEP}]
43 >=dev-python/tornado-4.2.1[\${PYTHON_USEDEP}]
44 >=dev-python/trustme-0.5.3[\${PYTHON_USEDEP}]
45 " "${PYTHON_TESTED[@]}")
50 distutils-r1_src_prepare
53 rm src/urllib3/packages/six.py || die
54 find -name '*.py' -exec sed -i \
55 -e 's:\([.]*\|urllib3\.\)\?packages\.six:six:g' \
56 -e 's:from \([.]*\|urllib3\.\)\?packages import six:import six:g' \
62 if ! has "${EPYTHON}" "${PYTHON_TESTED[@]/_/.}"; then
63 einfo "Skipping tests on ${EPYTHON}"
67 local EPYTEST_DESELECT=(
68 # unstable (relies on warning count)
69 test/with_dummyserver/test_proxy_poolmanager.py::TestHTTPProxyManager::test_proxy_verified_warning
70 # some random overflow
71 test/with_dummyserver/test_socketlevel.py::TestSSL::test_requesting_large_resources_via_ssl
73 has "${EPYTHON}" python3.{8..10} && EPYTEST_DESELECT+=(
74 test/contrib/test_pyopenssl.py::TestPyOpenSSLHelpers::test_get_subj_alt_name