1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, substituteAll
6, graphviz
7, xdg-utils
8, makeFontsConf
9, freefont_ttf
10, mock
11, pytestCheckHook
12, pytest-mock
13}:
14
15buildPythonPackage rec {
16 pname = "graphviz";
17 version = "0.18";
18
19 disabled = pythonOlder "3.6";
20
21 # patch does not apply to PyPI tarball due to different line endings
22 src = fetchFromGitHub {
23 owner = "xflr6";
24 repo = "graphviz";
25 rev = version;
26 sha256 = "sha256-K98CwG+V+EFwzyawVjRwVhbX2FVfoX7dCAD5PXAWTq8=";
27 };
28
29 patches = [
30 (substituteAll {
31 src = ./paths.patch;
32 inherit graphviz;
33 xdgutils = xdg-utils;
34 })
35 ];
36
37 postPatch = ''
38 sed -i "/--cov/d" setup.cfg
39 '';
40
41 # Fontconfig error: Cannot load default config file
42 FONTCONFIG_FILE = makeFontsConf {
43 fontDirectories = [ freefont_ttf ];
44 };
45
46 checkInputs = [ mock pytestCheckHook pytest-mock ];
47
48 preCheck = ''
49 export HOME=$TMPDIR
50 '';
51
52 meta = with lib; {
53 description = "Simple Python interface for Graphviz";
54 homepage = "https://github.com/xflr6/graphviz";
55 license = licenses.mit;
56 maintainers = with maintainers; [ dotlambda ];
57 };
58
59}