1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, fontconfig 5, graphviz 6, poetry-core 7, pytestCheckHook 8, pythonOlder 9, six 10, substituteAll 11, withGraphviz ? true 12}: 13 14buildPythonPackage rec { 15 pname = "anytree"; 16 version = "2.10.0"; 17 format = "pyproject"; 18 19 disabled = pythonOlder "3.7"; 20 21 src = fetchFromGitHub { 22 owner = "c0fec0de"; 23 repo = "anytree"; 24 rev = "refs/tags/${version}"; 25 hash = "sha256-9rxrHZBlQarfpYQvo6bJPGF+cdSROlwq+8TjXI18HDs="; 26 }; 27 28 patches = lib.optionals withGraphviz [ 29 (substituteAll { 30 src = ./graphviz.patch; 31 inherit graphviz; 32 }) 33 ]; 34 35 nativeBuildInputs = [ 36 poetry-core 37 ]; 38 39 propagatedBuildInputs = [ 40 six 41 ]; 42 43 nativeCheckInputs = [ 44 pytestCheckHook 45 ]; 46 47 # Tests print “Fontconfig error: Cannot load default config file” 48 preCheck = lib.optionalString withGraphviz '' 49 export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf 50 ''; 51 52 # Circular dependency anytree → graphviz → pango → glib → gtk-doc → anytree 53 doCheck = withGraphviz; 54 55 pythonImportsCheck = [ 56 "anytree" 57 ]; 58 59 meta = with lib; { 60 description = "Powerful and Lightweight Python Tree Data Structure"; 61 homepage = "https://github.com/c0fec0de/anytree"; 62 changelog = "https://github.com/c0fec0de/anytree/releases/tag/${version}"; 63 license = licenses.asl20; 64 maintainers = with maitnainers; [ ]; 65 }; 66}