summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/py-radix-sr/default.nix
blob: f1dc33548944d8add34da836cad405eacc4e6e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pytestCheckHook,
  pythonAtLeast,
}:

buildPythonPackage rec {
  pname = "py-radix-sr";
  version = "1.0.2";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "SEKOIA-IO";
    repo = "py-radix";
    tag = "v${version}";
    hash = "sha256-HeXWHdPeW3m0FMtqyHhZGhgCc706Y2xiN8hn9MFt/RM=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "name='py-radix'" "name='py-radix-sr'"

    substituteInPlace tests/test_{compat,regression}.py \
      --replace-fail assertEquals assertEqual \
      --replace-warn assertNotEquals assertNotEqual
  '';

  pythonImportsCheck = [ "radix" ];

  nativeCheckInputs = [ pytestCheckHook ];

  disabledTests = lib.optionals (pythonAtLeast "3.12") [
    # test does not complete on 3.12+
    "test_000_check_incref"
  ];

  meta = {
    description = "Python radix tree for IPv4 and IPv6 prefix matching";
    homepage = "https://github.com/SEKOIA-IO/py-radix";
    license = with lib.licenses; [
      isc
      bsdOriginal
    ];
  };
}