python311Packages.urllib3: refactor

Changed files
+29 -32
pkgs
development
python-modules
urllib3
+29 -32
pkgs/development/python-modules/urllib3/default.nix
··· 1 1 { lib 2 + , backports-zoneinfo 2 3 , brotli 3 4 , brotlicffi 4 5 , buildPythonPackage ··· 8 9 , hatchling 9 10 , idna 10 11 , isPyPy 11 - , mock 12 12 , pyopenssl 13 13 , pysocks 14 - , pytest-freezegun 15 14 , pytest-timeout 16 15 , pytestCheckHook 17 - , python-dateutil 16 + , pythonOlder 18 17 , tornado 19 18 , trustme 20 19 }: 21 20 22 - buildPythonPackage rec { 21 + let self = buildPythonPackage rec { 23 22 pname = "urllib3"; 24 23 version = "2.0.7"; 25 24 pyproject = true; ··· 33 32 hatchling 34 33 ]; 35 34 36 - # FIXME: remove backwards compatbility hack 37 - propagatedBuildInputs = passthru.optional-dependencies.brotli 38 - ++ passthru.optional-dependencies.socks; 35 + passthru.optional-dependencies = { 36 + brotli = if isPyPy then [ 37 + brotlicffi 38 + ] else [ 39 + brotli 40 + ]; 41 + # Use carefully since pyopenssl is not supported aarch64-darwin 42 + secure = [ 43 + certifi 44 + cryptography 45 + idna 46 + pyopenssl 47 + ]; 48 + socks = [ 49 + pysocks 50 + ]; 51 + }; 39 52 40 53 nativeCheckInputs = [ 41 - python-dateutil 42 - mock 43 - pytest-freezegun 44 54 pytest-timeout 45 55 pytestCheckHook 46 56 tornado 47 57 trustme 48 - ]; 58 + ] ++ lib.optionals (pythonOlder "3.9") [ 59 + backports-zoneinfo 60 + ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); 49 61 50 62 # Tests in urllib3 are mostly timeout-based instead of event-based and 51 63 # are therefore inherently flaky. On your own machine, the tests will ··· 60 72 # Still, failures can occur and for that reason tests are disabled. 61 73 doCheck = false; 62 74 75 + passthru.tests.pytest = self.overridePythonAttrs (_: { doCheck = true; }); 76 + 63 77 preCheck = '' 64 78 export CI # Increases LONG_TIMEOUT 65 79 ''; ··· 68 82 "urllib3" 69 83 ]; 70 84 71 - passthru.optional-dependencies = { 72 - brotli = if isPyPy then [ 73 - brotlicffi 74 - ] else [ 75 - brotli 76 - ]; 77 - # Use carefully since pyopenssl is not supported aarch64-darwin 78 - secure = [ 79 - certifi 80 - cryptography 81 - idna 82 - pyopenssl 83 - ]; 84 - socks = [ 85 - pysocks 86 - ]; 87 - }; 88 - 89 85 meta = with lib; { 90 - description = "Powerful, sanity-friendly HTTP client for Python"; 91 - homepage = "https://github.com/shazow/urllib3"; 86 + description = "Powerful, user-friendly HTTP client for Python"; 87 + homepage = "https://github.com/urllib3/urllib3"; 92 88 changelog = "https://github.com/urllib3/urllib3/blob/${version}/CHANGES.rst"; 93 89 license = licenses.mit; 94 90 maintainers = with maintainers; [ fab ]; 95 91 }; 96 - } 92 + }; 93 + in self