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