1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 eventlet,
6 fetchPypi,
7 gevent,
8 pkgs,
9 process-tests,
10 pytestCheckHook,
11 pythonOlder,
12 redis,
13 withDjango ? false,
14 django-redis,
15}:
16
17buildPythonPackage rec {
18 pname = "python-redis-lock";
19 version = "4.0.0";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-Sr0Lz0kTasrWZye/VIbdJJQHjKVeSe+mk/eUB3MZCRo=";
27 };
28
29 propagatedBuildInputs = [ redis ] ++ lib.optionals withDjango [ django-redis ];
30
31 nativeCheckInputs = [
32 eventlet
33 gevent
34 pytestCheckHook
35 process-tests
36 pkgs.redis
37 ];
38
39 disabledTests =
40 [
41 # https://github.com/ionelmc/python-redis-lock/issues/86
42 "test_no_overlap2"
43 ]
44 ++ lib.optionals stdenv.isDarwin [
45 # fail on Darwin because it defaults to multiprocessing `spawn`
46 "test_reset_signalizes"
47 "test_reset_all_signalizes"
48 ];
49
50 pythonImportsCheck = [ "redis_lock" ];
51
52 meta = with lib; {
53 changelog = "https://github.com/ionelmc/python-redis-lock/blob/v${version}/CHANGELOG.rst";
54 description = "Lock context manager implemented via redis SETNX/BLPOP";
55 homepage = "https://github.com/ionelmc/python-redis-lock";
56 license = licenses.bsd2;
57 maintainers = with maintainers; [ vanschelven ];
58 };
59}