about summary refs log tree commit diff
path: root/pkgs/development/python-modules/xdot/default.nix
blob: 8cd817ea1c90ff67c046cdce192f2c79de8ceb11 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  python,
  xvfb-run,
  wrapGAppsHook3,
  gobject-introspection,
  pygobject3,
  graphviz,
  gtk3,
  numpy,
  packaging,
  setuptools,
}:

buildPythonPackage rec {
  pname = "xdot";
  version = "1.4";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "jrfonseca";
    repo = "xdot.py";
    rev = version;
    hash = "sha256-fkO1bINRkCCzVRrQg9+vIODbN+bpXq2OHBKkzzZUZNA=";
  };

  build-system = [ setuptools ];

  nativeBuildInputs = [
    gobject-introspection
    wrapGAppsHook3
  ];

  buildInputs = [
    graphviz
    gtk3
  ];

  dependencies = [
    pygobject3
    numpy
    packaging
  ];
  nativeCheckInputs = [ xvfb-run ];

  dontWrapGApps = true;
  # Arguments to be passed to `makeWrapper`, only used by buildPython*
  preFixup = ''
    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
    makeWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ graphviz ]})
  '';

  checkPhase = ''
    runHook preCheck

    xvfb-run -s '-screen 0 800x600x24' ${python.interpreter} test.py

    runHook postCheck
  '';

  doCheck = true;

  meta = with lib; {
    description = "Interactive viewer for graphs written in Graphviz's dot";
    mainProgram = "xdot";
    homepage = "https://github.com/jrfonseca/xdot.py";
    license = licenses.lgpl3Plus;
  };
}