1{ lib
2, buildPythonPackage
3, cherrypy
4, fetchFromGitHub
5, flit-core
6, filelock
7, mock
8, msgpack
9, pytestCheckHook
10, pythonOlder
11, redis
12, requests
13}:
14
15buildPythonPackage rec {
16 pname = "cachecontrol";
17 version = "0.13.1";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.6";
21
22 __darwinAllowLocalNetworking = true;
23
24 src = fetchFromGitHub {
25 owner = "ionrock";
26 repo = pname;
27 rev = "refs/tags/v${version}";
28 hash = "sha256-4N+vk65WxOrT+IJRn+lEnbs5vlWQh9ievVHWWe3BKJ0=";
29 };
30
31 postPatch = ''
32 # https://github.com/ionrock/cachecontrol/issues/297
33 substituteInPlace tests/test_etag.py --replace \
34 "requests.adapters.HTTPResponse.from_httplib" \
35 "urllib3.response.HTTPResponse.from_httplib"
36 '';
37
38 nativeBuildInputs = [
39 flit-core
40 ];
41
42 propagatedBuildInputs = [
43 msgpack
44 requests
45 ];
46
47 passthru.optional-dependencies = {
48 filecache = [
49 filelock
50 ];
51 redis = [
52 redis
53 ];
54 };
55
56 nativeCheckInputs = [
57 cherrypy
58 mock
59 pytestCheckHook
60 requests
61 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
62
63 pythonImportsCheck = [
64 "cachecontrol"
65 ];
66
67 meta = with lib; {
68 description = "Httplib2 caching for requests";
69 homepage = "https://github.com/ionrock/cachecontrol";
70 changelog = "https://github.com/psf/cachecontrol/releases/tag/v${version}";
71 license = licenses.asl20;
72 maintainers = with maintainers; [ ];
73 };
74}