1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 substituteAll,
6 graphviz,
7 python,
8 pytestCheckHook,
9 chardet,
10 pythonOlder,
11 pyparsing,
12}:
13
14buildPythonPackage rec {
15 pname = "pydot";
16 version = "2.0.0";
17 format = "setuptools";
18
19 disabled = pythonOlder "3.5";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-YCRq8hUSP6Bi8hzXkb5n3aI6bygN8J9okZ5jeh5PMjU=";
24 };
25
26 propagatedBuildInputs = [ pyparsing ];
27
28 nativeCheckInputs = [
29 chardet
30 pytestCheckHook
31 ];
32
33 patches = [
34 (substituteAll {
35 src = ./hardcode-graphviz-path.patch;
36 inherit graphviz;
37 })
38 ];
39
40 postPatch = ''
41 # test_graphviz_regression_tests also fails upstream: https://github.com/pydot/pydot/pull/198
42 substituteInPlace test/pydot_unittest.py \
43 --replace "test_graphviz_regression_tests" "no_test_graphviz_regression_tests" \
44 # Patch path for pytestCheckHook
45 substituteInPlace test/pydot_unittest.py \
46 --replace "shapefile_dir = os.path.join(test_dir, 'from-past-to-future')" "shapefile_dir = 'test/from-past-to-future'" \
47 --replace "path = os.path.join(test_dir, TESTS_DIR_1)" "path = os.path.join('test/', TESTS_DIR_1)"
48 '';
49
50 pytestFlagsArray = [ "test/pydot_unittest.py" ];
51
52 disabledTests = [
53 # broken, fixed after 2.0.0
54 "test_graph_with_shapefiles"
55 ];
56
57 pythonImportsCheck = [ "pydot" ];
58
59 meta = with lib; {
60 description = "Allows to create both directed and non directed graphs from Python";
61 homepage = "https://github.com/erocarrera/pydot";
62 license = licenses.mit;
63 maintainers = [ ];
64 };
65}