2021-03-19 17:17:44 +00:00
|
|
|
{ lib
|
|
|
|
, brotli
|
2022-06-26 10:26:21 +00:00
|
|
|
, brotlicffi
|
2021-03-19 17:17:44 +00:00
|
|
|
, buildPythonPackage
|
2022-06-26 10:26:21 +00:00
|
|
|
, certifi
|
2021-03-19 17:17:44 +00:00
|
|
|
, cryptography
|
|
|
|
, fetchPypi
|
|
|
|
, idna
|
2022-07-14 12:49:19 +00:00
|
|
|
, isPyPy
|
2021-03-19 17:17:44 +00:00
|
|
|
, mock
|
|
|
|
, pyopenssl
|
|
|
|
, pysocks
|
|
|
|
, pytest-freezegun
|
|
|
|
, pytest-timeout
|
|
|
|
, pytestCheckHook
|
2022-07-14 12:49:19 +00:00
|
|
|
, python-dateutil
|
2021-03-19 17:17:44 +00:00
|
|
|
, tornado
|
|
|
|
, trustme
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "urllib3";
|
2022-08-21 13:32:41 +00:00
|
|
|
version = "1.26.11";
|
2022-02-10 20:34:41 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-08-21 13:32:41 +00:00
|
|
|
hash = "sha256-6m6PshCxnZUPq5O2DJAJImxjoogIvIOG4FMB4liDrAo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
# FIXME: remove backwards compatbility hack
|
|
|
|
propagatedBuildInputs = passthru.optional-dependencies.brotli
|
2022-07-14 12:49:19 +00:00
|
|
|
++ passthru.optional-dependencies.socks;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
checkInputs = [
|
2021-07-04 02:40:35 +00:00
|
|
|
python-dateutil
|
2021-03-19 17:17:44 +00:00
|
|
|
mock
|
|
|
|
pytest-freezegun
|
|
|
|
pytest-timeout
|
|
|
|
pytestCheckHook
|
|
|
|
tornado
|
|
|
|
trustme
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
# Tests in urllib3 are mostly timeout-based instead of event-based and
|
|
|
|
# are therefore inherently flaky. On your own machine, the tests will
|
|
|
|
# typically build fine, but on a loaded cluster such as Hydra random
|
|
|
|
# timeouts will occur.
|
|
|
|
#
|
|
|
|
# The urllib3 test suite has two different timeouts in their test suite
|
|
|
|
# (see `test/__init__.py`):
|
|
|
|
# - SHORT_TIMEOUT
|
|
|
|
# - LONG_TIMEOUT
|
|
|
|
# When CI is in the env, LONG_TIMEOUT will be significantly increased.
|
|
|
|
# Still, failures can occur and for that reason tests are disabled.
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
preCheck = ''
|
|
|
|
export CI # Increases LONG_TIMEOUT
|
|
|
|
'';
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"urllib3"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
brotli = if isPyPy then [ brotlicffi ] else [ brotli ];
|
2022-07-14 12:49:19 +00:00
|
|
|
# Use carefully since pyopenssl is not supported aarch64-darwin
|
2022-06-26 10:26:21 +00:00
|
|
|
secure = [ certifi cryptography idna pyopenssl ];
|
|
|
|
socks = [ pysocks ];
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Powerful, sanity-friendly HTTP client for Python";
|
|
|
|
homepage = "https://github.com/shazow/urllib3";
|
|
|
|
license = licenses.mit;
|
2021-03-19 17:17:44 +00:00
|
|
|
maintainers = with maintainers; [ fab ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|