2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fontconfig,
|
|
|
|
graphviz,
|
|
|
|
poetry-core,
|
|
|
|
pytest7CheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
six,
|
|
|
|
substituteAll,
|
|
|
|
withGraphviz ? true,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "anytree";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.12.1";
|
2023-10-09 19:29:22 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "c0fec0de";
|
|
|
|
repo = "anytree";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-5HU8kR3B2RHiGBraQ2FTgVtGHJi+Lha9U/7rpNsYCCI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = lib.optionals withGraphviz [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./graphviz.patch;
|
|
|
|
inherit graphviz;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ poetry-core ];
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ six ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytest7CheckHook ];
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
# Tests print “Fontconfig error: Cannot load default config file”
|
2020-04-24 23:36:52 +00:00
|
|
|
preCheck = lib.optionalString withGraphviz ''
|
|
|
|
export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
|
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
# Circular dependency anytree → graphviz → pango → glib → gtk-doc → anytree
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = withGraphviz;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "anytree" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Powerful and Lightweight Python Tree Data Structure";
|
|
|
|
homepage = "https://github.com/c0fec0de/anytree";
|
2023-10-09 19:29:22 +00:00
|
|
|
changelog = "https://github.com/c0fec0de/anytree/releases/tag/${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2023-10-09 19:29:22 +00:00
|
|
|
maintainers = with maitnainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|