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