2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
2024-07-27 06:49:29 +00:00
|
|
|
setuptools,
|
2024-06-05 15:53:02 +00:00
|
|
|
eventlet,
|
|
|
|
fetchPypi,
|
2024-07-27 06:49:29 +00:00
|
|
|
fetchpatch,
|
2024-06-05 15:53:02 +00:00
|
|
|
gevent,
|
|
|
|
pkgs,
|
|
|
|
process-tests,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
redis,
|
|
|
|
django-redis,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-redis-lock";
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "4.0.0";
|
2024-07-27 06:49:29 +00:00
|
|
|
|
|
|
|
pyproject = true;
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-Sr0Lz0kTasrWZye/VIbdJJQHjKVeSe+mk/eUB3MZCRo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# Fix django tests
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace tests/test_project/settings.py \
|
2024-09-19 14:19:46 +00:00
|
|
|
--replace-fail "USE_L10N = True" ""
|
2024-07-27 06:49:29 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# https://github.com/ionelmc/python-redis-lock/pull/119
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/ionelmc/python-redis-lock/commit/ae404b7834990b833c1f0f703ec8fbcfecd201c2.patch";
|
|
|
|
hash = "sha256-Fo43+pCtnrEMxMdEEdo0YfJGkBlhhH0GjYNgpZeHF3U=";
|
|
|
|
})
|
|
|
|
./test_signal_expiration_increase_sleep.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
build-system = [ setuptools ];
|
|
|
|
|
|
|
|
dependencies = [ redis ];
|
|
|
|
|
|
|
|
optional-dependencies.django = [ django-redis ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
eventlet
|
|
|
|
gevent
|
2021-05-20 23:08:51 +00:00
|
|
|
pytestCheckHook
|
|
|
|
process-tests
|
|
|
|
pkgs.redis
|
2024-07-27 06:49:29 +00:00
|
|
|
] ++ optional-dependencies.django;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# For Django tests
|
|
|
|
preCheck = "export DJANGO_SETTINGS_MODULE=test_project.settings";
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-07-27 06:49:29 +00:00
|
|
|
# fail on Darwin because it defaults to multiprocessing `spawn`
|
|
|
|
"test_reset_signalizes"
|
|
|
|
"test_reset_all_signalizes"
|
|
|
|
];
|
2024-06-05 15:53:02 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "redis_lock" ];
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-02-02 18:25:31 +00:00
|
|
|
changelog = "https://github.com/ionelmc/python-redis-lock/blob/v${version}/CHANGELOG.rst";
|
|
|
|
description = "Lock context manager implemented via redis SETNX/BLPOP";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/ionelmc/python-redis-lock";
|
|
|
|
license = licenses.bsd2;
|
2024-07-27 06:49:29 +00:00
|
|
|
maintainers = with maintainers; [ erictapen ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|