1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pythonAtLeast,
7}:
8
9buildPythonPackage rec {
10 pname = "py-radix-sr";
11 version = "1.0.2";
12 format = "setuptools";
13
14 src = fetchFromGitHub {
15 owner = "SEKOIA-IO";
16 repo = "py-radix";
17 tag = "v${version}";
18 hash = "sha256-HeXWHdPeW3m0FMtqyHhZGhgCc706Y2xiN8hn9MFt/RM=";
19 };
20
21 postPatch = ''
22 substituteInPlace setup.py \
23 --replace "name='py-radix'" "name='py-radix-sr'"
24
25 substituteInPlace tests/test_{compat,regression}.py \
26 --replace-fail assertEquals assertEqual \
27 --replace-warn assertNotEquals assertNotEqual
28 '';
29
30 pythonImportsCheck = [ "radix" ];
31
32 nativeCheckInputs = [ pytestCheckHook ];
33
34 disabledTests = lib.optionals (pythonAtLeast "3.12") [
35 # test does not complete on 3.12+
36 "test_000_check_incref"
37 ];
38
39 meta = with lib; {
40 description = "Python radix tree for IPv4 and IPv6 prefix matching";
41 homepage = "https://github.com/SEKOIA-IO/py-radix";
42 license = with licenses; [
43 isc
44 bsdOriginal
45 ];
46 teams = [ teams.wdz ];
47 };
48}