nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 pytestCheckHook,
8 setuptools,
9}:
10
11buildPythonPackage rec {
12 pname = "token-bucket";
13 version = "0.3.0";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "falconry";
18 repo = "token-bucket";
19 tag = version;
20 hash = "sha256-dazqJRpC8FUHOhgKFzDnIl5CT2L74J2o2Hsm0IQf4Cg=";
21 };
22
23 patches = [
24 # Replace imp with importlib, https://github.com/falconry/token-bucket/pull/24
25 (fetchpatch {
26 name = "remove-imp.patch";
27 url = "https://github.com/falconry/token-bucket/commit/10a3c9f4de00f4933349f66b4c72b6c96db6e766.patch";
28 hash = "sha256-Hk5+i3xzeA3F1kXRaRarWT9mff2lT2WNmTfTZvYzGYI=";
29 })
30 ];
31
32 postPatch = ''
33 substituteInPlace setup.py \
34 --replace "'pytest-runner'" ""
35 '';
36
37 nativeBuildInputs = [ setuptools ];
38
39 nativeCheckInputs = [ pytestCheckHook ];
40
41 doCheck = !stdenv.hostPlatform.isDarwin;
42
43 meta = {
44 description = "Token Bucket Implementation for Python Web Apps";
45 homepage = "https://github.com/falconry/token-bucket";
46 changelog = "https://github.com/falconry/token-bucket/releases/tag/${version}";
47 license = lib.licenses.asl20;
48 maintainers = with lib.maintainers; [ hexa ];
49 };
50}