1{ lib
2, brotli
3, buildPythonPackage
4, certifi
5, cryptography
6, dateutil
7, fetchpatch
8, fetchPypi
9, idna
10, mock
11, pyopenssl
12, pysocks
13, pytest-freezegun
14, pytest-timeout
15, pytestCheckHook
16, pythonOlder
17, tornado
18, trustme
19}:
20
21buildPythonPackage rec {
22 pname = "urllib3";
23 version = "1.26.2";
24
25 src = fetchPypi {
26 inherit pname version;
27 sha256 = "19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08";
28 };
29
30 patches = [
31 (fetchpatch {
32 name = "CVE-2021-28363.patch";
33 url = "https://github.com/urllib3/urllib3/commit/8d65ea1ecf6e2cdc27d42124e587c1b83a3118b0.patch";
34 sha256 = "1lqhrd11p03iv14bp89rh67ynf000swmwsfvr3jpfdycdqr3ka9q";
35 })
36 ];
37
38 propagatedBuildInputs = [
39 brotli
40 certifi
41 cryptography
42 idna
43 pyopenssl
44 pysocks
45 ];
46
47 checkInputs = [
48 dateutil
49 mock
50 pytest-freezegun
51 pytest-timeout
52 pytestCheckHook
53 tornado
54 trustme
55 ];
56
57 # Tests in urllib3 are mostly timeout-based instead of event-based and
58 # are therefore inherently flaky. On your own machine, the tests will
59 # typically build fine, but on a loaded cluster such as Hydra random
60 # timeouts will occur.
61 #
62 # The urllib3 test suite has two different timeouts in their test suite
63 # (see `test/__init__.py`):
64 # - SHORT_TIMEOUT
65 # - LONG_TIMEOUT
66 # When CI is in the env, LONG_TIMEOUT will be significantly increased.
67 # Still, failures can occur and for that reason tests are disabled.
68 doCheck = false;
69
70 preCheck = ''
71 export CI # Increases LONG_TIMEOUT
72 '';
73
74 pythonImportsCheck = [ "urllib3" ];
75
76 meta = with lib; {
77 description = "Powerful, sanity-friendly HTTP client for Python";
78 homepage = "https://github.com/shazow/urllib3";
79 license = licenses.mit;
80 maintainers = with maintainers; [ fab ];
81 };
82}