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