1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 importlib-metadata,
6 pythonOlder,
7 setuptools,
8}:
9
10buildPythonPackage rec {
11 pname = "pyroute2";
12 version = "0.7.12";
13 pyproject = true;
14
15 disabled = pythonOlder "3.7";
16
17 src = fetchFromGitHub {
18 owner = "svinota";
19 repo = "pyroute2";
20 rev = "refs/tags/${version}";
21 hash = "sha256-zB792ZwDWd74YBYvQ5au0t2RWTIAqrWvNtQ/e+ZEk50=";
22 };
23
24 nativeBuildInputs = [ setuptools ];
25
26 propagatedBuildInputs = lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
27
28 # Requires root privileges, https://github.com/svinota/pyroute2/issues/778
29 doCheck = false;
30
31 pythonImportsCheck = [
32 "pyroute2"
33 "pyroute2.common"
34 "pyroute2.config"
35 "pyroute2.ethtool"
36 "pyroute2.ipdb"
37 "pyroute2.ipset"
38 "pyroute2.ndb"
39 "pyroute2.nftables"
40 "pyroute2.nslink"
41 "pyroute2.protocols"
42 ];
43
44 postPatch = ''
45 patchShebangs util
46 make VERSION
47 '';
48
49 meta = with lib; {
50 description = "Python Netlink library";
51 homepage = "https://github.com/svinota/pyroute2";
52 changelog = "https://github.com/svinota/pyroute2/blob/${version}/CHANGELOG.rst";
53 license = with licenses; [
54 asl20 # or
55 gpl2Plus
56 ];
57 maintainers = with maintainers; [
58 fab
59 mic92
60 ];
61 platforms = platforms.unix;
62 };
63}