summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pystemd/default.nix
blob: 67143d6bfd49bac21d807262846e39eaa1f8174b (plain)
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
58
59
60
61
62
63
64
65
66
67
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  systemd,
  lxml,
  psutil,
  pytestCheckHook,
  pkg-config,
  cython,
}:

buildPythonPackage rec {
  pname = "pystemd";
  version = "0.13.4";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "systemd";
    repo = "pystemd";
    tag = "v${version}";
    hash = "sha256-Ph0buiyH2cLRXyqgA8DmpE9crb/x8OaerIoZuv8hjMI=";
  };

  buildInputs = [ systemd ];

  build-system = [
    setuptools
    cython
  ];

  nativeBuildInputs = [
    pkg-config
  ];

  dependencies = [
    lxml
    psutil
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  # Having the source root in `sys.path` causes import issues
  preCheck = ''
    cd tests
  '';

  disabledTestPaths = [
    "test_version.py" # Requires cstq which is not in nixpkgs
  ];

  pythonImportsCheck = [ "pystemd" ];

  meta = {
    description = ''
      Thin Cython-based wrapper on top of libsystemd, focused on exposing the
      dbus API via sd-bus in an automated and easy to consume way
    '';
    homepage = "https://github.com/facebookincubator/pystemd";
    changelog = "https://github.com/systemd/pystemd/releases/tag/${src.tag}";
    license = lib.licenses.lgpl21Plus;
    maintainers = with lib.maintainers; [ flokli ];
  };
}