about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pydot/default.nix
blob: ac965f8404e034beb43e54be6aa75ca59cf6c34e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ lib
, buildPythonPackage
, fetchPypi
, substituteAll
, graphviz
, python
, pytestCheckHook
, chardet
, pythonOlder
, pyparsing
}:

buildPythonPackage rec {
  pname = "pydot";
  version = "1.4.2";
  format = "setuptools";

  disabled = pythonOlder "3.5";

  src = fetchPypi {
    inherit pname version;
    sha256 = "248081a39bcb56784deb018977e428605c1c758f10897a339fce1dd728ff007d";
  };

  propagatedBuildInputs = [
    pyparsing
  ];

  nativeCheckInputs = [
    chardet
    pytestCheckHook
  ];

  patches = [
    (substituteAll {
      src = ./hardcode-graphviz-path.patch;
      inherit graphviz;
    })
  ];

  postPatch = ''
    # test_graphviz_regression_tests also fails upstream: https://github.com/pydot/pydot/pull/198
    substituteInPlace test/pydot_unittest.py \
      --replace "test_graphviz_regression_tests" "no_test_graphviz_regression_tests" \
    # Patch path for pytestCheckHook
    substituteInPlace test/pydot_unittest.py \
      --replace "shapefile_dir = os.path.join(test_dir, 'from-past-to-future')" "shapefile_dir = 'test/from-past-to-future'" \
      --replace "path = os.path.join(test_dir, TESTS_DIR_1)" "path = os.path.join('test/', TESTS_DIR_1)"
  '';

  pytestFlagsArray = [
    "test/pydot_unittest.py"
  ];

  disabledTests = [
    "test_exception_msg"
    # Hash mismatch
    "test_my_regression_tests"
  ];

  pythonImportsCheck = [
    "pydot"
  ];

  meta = with lib; {
    description = "Allows to create both directed and non directed graphs from Python";
    homepage = "https://github.com/erocarrera/pydot";
    license = licenses.mit;
    maintainers = with maintainers; [ ];
  };
}