nixpkgs/pkgs/development/python-modules/anytree/default.nix

58 lines
1.3 KiB
Nix
Raw Normal View History

2019-05-16 19:51:23 +01:00
{ lib
, buildPythonPackage
2019-12-14 14:59:12 +00:00
, fetchPypi
, pythonOlder
2019-05-16 19:51:23 +01:00
, substituteAll
, six
, withGraphviz ? true
2019-05-16 19:51:23 +01:00
, graphviz
, fontconfig
# Tests
, pytestCheckHook
, nose
2019-05-16 19:51:23 +01:00
}:
buildPythonPackage rec {
pname = "anytree";
2020-06-06 07:46:57 +01:00
version = "2.8.0";
2019-05-16 19:51:23 +01:00
2019-12-14 14:59:12 +00:00
src = fetchPypi {
inherit pname version;
2020-06-06 07:46:57 +01:00
sha256 = "3f0f93f355a91bc3e6245319bf4c1d50e3416cc7a35cc1133c1ff38306bbccab";
2019-05-16 19:51:23 +01:00
};
patches = lib.optionals withGraphviz [
2019-05-16 19:51:23 +01:00
(substituteAll {
src = ./graphviz.patch;
inherit graphviz;
})
];
propagatedBuildInputs = [
six
];
# tests print “Fontconfig error: Cannot load default config file”
preCheck = lib.optionalString withGraphviz ''
2019-05-16 19:51:23 +01:00
export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
'';
# circular dependency anytree → graphviz → pango → glib → gtk-doc → anytree
doCheck = withGraphviz;
checkInputs = [ pytestCheckHook nose ];
2019-05-16 19:51:23 +01:00
pytestFlagsArray = lib.optionals (pythonOlder "3.4") [
# Use enums, which aren't available pre-python3.4
"--ignore=tests/test_resolver.py"
"--ignore=tests/test_search.py"
];
2019-05-16 19:51:23 +01:00
meta = with lib; {
description = "Powerful and Lightweight Python Tree Data Structure";
homepage = "https://github.com/c0fec0de/anytree";
2019-05-16 19:51:23 +01:00
license = licenses.asl20;
maintainers = [ maintainers.worldofpeace ];
};
}