1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 setuptools,
7 pkg-config,
8 libnl,
9 net-tools,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "ethtool";
15 version = "0.15";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "fedora-python";
20 repo = "python-ethtool";
21 tag = "v${version}";
22 hash = "sha256-0XzGaqpkEv3mpUsbfOtRl8E62iNdS7kRoo4oYrBjMys=";
23 };
24
25 patches = [
26 # https://github.com/fedora-python/python-ethtool/pull/60
27 (fetchpatch2 {
28 url = "https://github.com/fedora-python/python-ethtool/commit/f82dd763bd50affda993b9afe3b141069a1a7466.patch";
29 hash = "sha256-mtI7XsoyM43s2DFQdsBNpB8jJff7ZyO2J6SHodBrdrI=";
30 })
31 ];
32
33 postPatch = ''
34 substituteInPlace tests/parse_ifconfig.py \
35 --replace-fail "Popen('ifconfig'," "Popen('${lib.getExe' net-tools "ifconfig"}',"
36 '';
37
38 build-system = [ setuptools ];
39
40 nativeBuildInputs = [ pkg-config ];
41
42 buildInputs = [ libnl ];
43
44 pythonImportsCheck = [ "ethtool" ];
45
46 nativeCheckInputs = [
47 net-tools
48 pytestCheckHook
49 ];
50
51 meta = with lib; {
52 changelog = "https://github.com/fedora-python/python-ethtool/blob/${src.rev}/CHANGES.rst";
53 description = "Python bindings for the ethtool kernel interface";
54 homepage = "https://github.com/fedora-python/python-ethtool";
55 license = licenses.gpl2Plus;
56 };
57}