depot/third_party/nixpkgs/pkgs/development/python-modules/anytree/default.nix
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

59 lines
1.1 KiB
Nix

{ lib
, buildPythonPackage
, fetchPypi
, substituteAll
, fetchpatch
, nose
, six
, withGraphviz ? true
, graphviz
, fontconfig
}:
buildPythonPackage rec {
pname = "anytree";
version = "2.7.3";
src = fetchPypi {
inherit pname version;
sha256 = "05736hamjv4f38jw6z9y4wckc7mz18ivbizm1s3pb0n6fp1sy4zk";
};
patches = lib.optionals withGraphviz [
(substituteAll {
src = ./graphviz.patch;
inherit graphviz;
})
];
checkInputs = [
nose
];
propagatedBuildInputs = [
six
];
# 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;
checkPhase = ''
runHook preCheck
nosetests
runHook postCheck
'';
meta = with lib; {
description = "Powerful and Lightweight Python Tree Data Structure";
homepage = "https://github.com/c0fec0de/anytree";
license = licenses.asl20;
maintainers = [ maintainers.worldofpeace ];
};
}