2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2023-10-09 19:29:22 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, fontconfig
|
|
|
|
, graphviz
|
|
|
|
, poetry-core
|
|
|
|
, pytestCheckHook
|
2020-10-16 20:44:37 +00:00
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
, six
|
2023-10-09 19:29:22 +00:00
|
|
|
, substituteAll
|
2020-04-24 23:36:52 +00:00
|
|
|
, withGraphviz ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "anytree";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "2.12.0";
|
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-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-8mV9Lf6NLPUDVurXCxG+tqe7+3TrIn2H+7tHa6BpTzk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = lib.optionals withGraphviz [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./graphviz.patch;
|
|
|
|
inherit graphviz;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
six
|
|
|
|
];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"anytree"
|
2020-10-16 20:44:37 +00:00
|
|
|
];
|
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
|
|
|
};
|
|
|
|
}
|