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 meta = with lib; {
45 description = "Python Netlink library";
46 homepage = "https://github.com/svinota/pyroute2";
47 changelog = "https://github.com/svinota/pyroute2/blob/${version}/CHANGELOG.rst";
48 license = with licenses; [
49 asl20 # or
50 gpl2Plus
51 ];
52 maintainers = with maintainers; [
53 fab
54 mic92
55 ];
56 platforms = platforms.unix;
57 };
58}