depot/third_party/nixpkgs/pkgs/development/python-modules/anytree/default.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

66 lines
1.4 KiB
Nix

{ 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
];
# 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; [ ];
};
}