2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
setuptools,
|
2021-05-28 09:39:13 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "token-bucket";
|
2021-07-04 02:40:35 +00:00
|
|
|
version = "0.3.0";
|
2024-01-25 14:12:00 +00:00
|
|
|
pyproject = true;
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "falconry";
|
|
|
|
repo = pname;
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-dazqJRpC8FUHOhgKFzDnIl5CT2L74J2o2Hsm0IQf4Cg=";
|
2021-05-28 09:39:13 +00:00
|
|
|
};
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
patches = [
|
|
|
|
# Replace imp with importlib, https://github.com/falconry/token-bucket/pull/24
|
|
|
|
(fetchpatch {
|
|
|
|
name = "remove-imp.patch";
|
|
|
|
url = "https://github.com/falconry/token-bucket/commit/10a3c9f4de00f4933349f66b4c72b6c96db6e766.patch";
|
|
|
|
hash = "sha256-Hk5+i3xzeA3F1kXRaRarWT9mff2lT2WNmTfTZvYzGYI=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "'pytest-runner'" ""
|
|
|
|
'';
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
2024-01-25 14:12:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Token Bucket Implementation for Python Web Apps";
|
|
|
|
homepage = "https://github.com/falconry/token-bucket";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/falconry/token-bucket/releases/tag/${version}";
|
2021-05-28 09:39:13 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ hexa ];
|
|
|
|
};
|
|
|
|
}
|