1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 cryptography, 6 fetchFromGitHub, 7 mock, 8 pyparsing, 9 pytest-forked, 10 pytest-randomly, 11 pytest-timeout, 12 pytestCheckHook, 13 pythonAtLeast, 14 six, 15}: 16 17buildPythonPackage rec { 18 pname = "httplib2"; 19 version = "0.22.0"; 20 format = "setuptools"; 21 22 src = fetchFromGitHub { 23 owner = pname; 24 repo = pname; 25 rev = "v${version}"; 26 hash = "sha256-76gdiRbF535CEaNXwNqsVeVc0dKglovMPQpGsOkbd/4="; 27 }; 28 29 postPatch = '' 30 sed -i "/--cov/d" setup.cfg 31 ''; 32 33 propagatedBuildInputs = [ pyparsing ]; 34 35 nativeCheckInputs = [ 36 cryptography 37 mock 38 pytest-forked 39 pytest-randomly 40 pytest-timeout 41 six 42 pytestCheckHook 43 ]; 44 45 __darwinAllowLocalNetworking = true; 46 47 # Don't run tests for older Pythons 48 doCheck = pythonAtLeast "3.9"; 49 50 disabledTests = 51 [ 52 # ValueError: Unable to load PEM file. 53 # https://github.com/httplib2/httplib2/issues/192#issuecomment-993165140 54 "test_client_cert_password_verified" 55 56 # improper pytest marking 57 "test_head_301" 58 "test_303" 59 ] 60 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 61 # fails with "ConnectionResetError: [Errno 54] Connection reset by peer" 62 "test_connection_close" 63 # fails with HTTP 408 Request Timeout, instead of expected 200 OK 64 "test_timeout_subsequent" 65 "test_connection_close" 66 ]; 67 68 pytestFlagsArray = [ "--ignore python2" ]; 69 70 pythonImportsCheck = [ "httplib2" ]; 71 72 meta = with lib; { 73 description = "Comprehensive HTTP client library"; 74 homepage = "https://github.com/httplib2/httplib2"; 75 license = licenses.mit; 76 maintainers = with maintainers; [ fab ]; 77 }; 78}