1{ lib
2, buildPythonPackage
3, cherrypy
4, fetchFromGitHub
5, lockfile
6, mock
7, msgpack
8, pytestCheckHook
9, pythonOlder
10, redis
11, requests
12}:
13
14buildPythonPackage rec {
15 pname = "cachecontrol";
16 version = "0.12.11";
17 format = "setuptools";
18
19 disabled = pythonOlder "3.6";
20
21 __darwinAllowLocalNetworking = true;
22
23 src = fetchFromGitHub {
24 owner = "ionrock";
25 repo = pname;
26 rev = "v${version}";
27 hash = "sha256-uUPIQz/n347Q9G7NDOGuB760B/KxOglUxiS/rYjt5Po=";
28 };
29
30 postPatch = ''
31 # https://github.com/ionrock/cachecontrol/issues/297
32 substituteInPlace tests/test_etag.py --replace \
33 "requests.adapters.HTTPResponse.from_httplib" \
34 "urllib3.response.HTTPResponse.from_httplib"
35 '';
36
37 propagatedBuildInputs = [
38 msgpack
39 requests
40 ];
41
42 nativeCheckInputs = [
43 cherrypy
44 mock
45 pytestCheckHook
46 ] ++ passthru.optional-dependencies.filecache;
47
48 pythonImportsCheck = [
49 "cachecontrol"
50 ];
51
52 passthru.optional-dependencies = {
53 filecache = [ lockfile ];
54 redis = [ redis ];
55 };
56
57 meta = with lib; {
58 description = "Httplib2 caching for requests";
59 homepage = "https://github.com/ionrock/cachecontrol";
60 license = licenses.asl20;
61 maintainers = with maintainers; [ costrouc ];
62 };
63}