1{ lib
2, stdenv
3, buildPythonPackage
4, cryptography
5, fetchFromGitHub
6, isPy27
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.21.0";
20 format = "setuptools";
21
22 src = fetchFromGitHub {
23 owner = pname;
24 repo = pname;
25 rev = "v${version}";
26 hash = "sha256-1Pl+l28J7crfO2UY/9/D019IzOHWOwjR+UvVEHICTqU=";
27 };
28
29 postPatch = ''
30 sed -i "/--cov/d" setup.cfg
31 '';
32
33 propagatedBuildInputs = [
34 pyparsing
35 ];
36
37 nativeCheckInputs = [
38 cryptography
39 mock
40 pytest-forked
41 pytest-randomly
42 pytest-timeout
43 six
44 pytestCheckHook
45 ];
46
47 __darwinAllowLocalNetworking = true;
48
49 # Don't run tests for older Pythons
50 doCheck = pythonAtLeast "3.9";
51
52 disabledTests = [
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 ] ++ lib.optionals stdenv.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 = [
69 "--ignore python2"
70 ];
71
72 pythonImportsCheck = [
73 "httplib2"
74 ];
75
76 meta = with lib; {
77 description = "A comprehensive HTTP client library";
78 homepage = "https://github.com/httplib2/httplib2";
79 license = licenses.mit;
80 maintainers = with maintainers; [ fab ];
81 };
82}