about summary refs log tree commit diff
path: root/pkgs/development/python-modules/ethtool/default.nix
blob: 497e6cc888513772fc05da28c21ba01c20d3cbb9 (plain) (blame)
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
48
49
50
51
52
53
54
55
56
57
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch2,
  setuptools,
  pkg-config,
  libnl,
  nettools,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "ethtool";
  version = "0.15";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "fedora-python";
    repo = "python-ethtool";
    rev = "refs/tags/v${version}";
    hash = "sha256-0XzGaqpkEv3mpUsbfOtRl8E62iNdS7kRoo4oYrBjMys=";
  };

  patches = [
    # https://github.com/fedora-python/python-ethtool/pull/60
    (fetchpatch2 {
      url = "https://github.com/fedora-python/python-ethtool/commit/f82dd763bd50affda993b9afe3b141069a1a7466.patch";
      hash = "sha256-mtI7XsoyM43s2DFQdsBNpB8jJff7ZyO2J6SHodBrdrI=";
    })
  ];

  postPatch = ''
    substituteInPlace tests/parse_ifconfig.py \
      --replace-fail "Popen('ifconfig'," "Popen('${lib.getExe' nettools "ifconfig"}',"
  '';

  build-system = [ setuptools ];

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [ libnl ];

  pythonImportsCheck = [ "ethtool" ];

  nativeCheckInputs = [
    nettools
    pytestCheckHook
  ];

  meta = with lib; {
    changelog = "https://github.com/fedora-python/python-ethtool/blob/${src.rev}/CHANGES.rst";
    description = "Python bindings for the ethtool kernel interface";
    homepage = "https://github.com/fedora-python/python-ethtool";
    license = licenses.gpl2Plus;
  };
}