about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/anytree/default.nix
blob: f18fa10557f3ee98765c1d475ac4e21dc28717ac (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
, fetchFromGitHub
, fontconfig
, graphviz
, poetry-core
, pytestCheckHook
, pythonOlder
, six
, substituteAll
, withGraphviz ? true
}:

buildPythonPackage rec {
  pname = "anytree";
  version = "2.12.0";
  format = "pyproject";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "c0fec0de";
    repo = "anytree";
    rev = "refs/tags/${version}";
    hash = "sha256-8mV9Lf6NLPUDVurXCxG+tqe7+3TrIn2H+7tHa6BpTzk=";
  };

  patches = lib.optionals withGraphviz [
    (substituteAll {
      src = ./graphviz.patch;
      inherit graphviz;
    })
  ];

  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs = [
    six
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  pytestFlagsArray = [
    # pytest.PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
    "-W" "ignore::pytest.PytestRemovedIn8Warning"
  ];

  # Tests print “Fontconfig error: Cannot load default config file”
  preCheck = lib.optionalString withGraphviz ''
    export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
  '';

  # Circular dependency anytree → graphviz → pango → glib → gtk-doc → anytree
  doCheck = withGraphviz;

  pythonImportsCheck = [
    "anytree"
  ];

  meta = with lib; {
    description = "Powerful and Lightweight Python Tree Data Structure";
    homepage = "https://github.com/c0fec0de/anytree";
    changelog = "https://github.com/c0fec0de/anytree/releases/tag/${version}";
    license = licenses.asl20;
    maintainers = with maitnainers; [ ];
  };
}