1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, substituteAll
5, graphviz
6, makeFontsConf
7, freefont_ttf
8, mock
9, pytest
10, pytest-mock
11, pytestcov
12}:
13
14buildPythonPackage rec {
15 pname = "graphviz";
16 version = "0.14.1";
17
18 # patch does not apply to PyPI tarball due to different line endings
19 src = fetchFromGitHub {
20 owner = "xflr6";
21 repo = "graphviz";
22 rev = version;
23 sha256 = "02bdiac5x93f2mjw5kpgs6kv81hzg07y0mw1nxvhyg8aignzmh3c";
24 };
25
26 patches = [
27 (substituteAll {
28 src = ./hardcode-graphviz-path.patch;
29 inherit graphviz;
30 })
31 ];
32
33 # Fontconfig error: Cannot load default config file
34 FONTCONFIG_FILE = makeFontsConf {
35 fontDirectories = [ freefont_ttf ];
36 };
37
38 checkInputs = [ mock pytest pytest-mock pytestcov ];
39
40 checkPhase = ''
41 pytest
42 '';
43
44 meta = with lib; {
45 description = "Simple Python interface for Graphviz";
46 homepage = "https://github.com/xflr6/graphviz";
47 license = licenses.mit;
48 maintainers = with maintainers; [ dotlambda ];
49 };
50
51}