1{ lib
2, stdenv
3, buildPythonPackage
4, pythonOlder
5, fetchFromGitHub
6, substituteAll
7, graphviz
8, xdg-utils
9, makeFontsConf
10, freefont_ttf
11, mock
12, pytest
13, pytest-mock
14, python
15}:
16
17buildPythonPackage rec {
18 pname = "graphviz";
19 version = "0.20.1";
20
21 disabled = pythonOlder "3.7";
22
23 # patch does not apply to PyPI tarball due to different line endings
24 src = fetchFromGitHub {
25 owner = "xflr6";
26 repo = "graphviz";
27 rev = version;
28 hash = "sha256-plhWG9mE9DoTMg7mWCvFLAgtBx01LAgJ0gQ/mqBU3yc=";
29 };
30
31 patches = [
32 (substituteAll {
33 src = ./paths.patch;
34 inherit graphviz;
35 xdgutils = xdg-utils;
36 })
37 ];
38
39 postPatch = ''
40 sed -i "/--cov/d" setup.cfg
41 '';
42
43 # Fontconfig error: Cannot load default config file
44 FONTCONFIG_FILE = makeFontsConf {
45 fontDirectories = [ freefont_ttf ];
46 };
47
48 nativeCheckInputs = [
49 mock
50 pytest
51 pytest-mock
52 ];
53
54 checkPhase = ''
55 runHook preCheck
56
57 HOME=$TMPDIR ${python.interpreter} run-tests.py
58
59 runHook postCheck
60 '';
61
62 # Too many failures due to attempting to connect to com.apple.fonts daemon
63 doCheck = !stdenv.isDarwin;
64
65 meta = with lib; {
66 description = "Simple Python interface for Graphviz";
67 homepage = "https://github.com/xflr6/graphviz";
68 changelog = "https://github.com/xflr6/graphviz/blob/${src.rev}/CHANGES.rst";
69 license = licenses.mit;
70 maintainers = with maintainers; [ dotlambda ];
71 };
72
73}