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