1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, substituteAll
5, fetchpatch
6, nose
7, six
8, graphviz
9, fontconfig
10}:
11
12buildPythonPackage rec {
13 pname = "anytree";
14 version = "2.6.0";
15
16 src = fetchFromGitHub {
17 owner = "c0fec0de";
18 repo = pname;
19 rev = version;
20 sha256 = "1k3yj9h3ssjlz57r4g1qzxvprxjp7n92vms9fv0d46pigylxm5i3";
21 };
22
23 patches = [
24 (substituteAll {
25 src = ./graphviz.patch;
26 inherit graphviz;
27 })
28 # Fix tests python3.7
29 # See: https://github.com/c0fec0de/anytree/pull/85
30 (fetchpatch {
31 url = "https://github.com/c0fec0de/anytree/commit/dd1b3d325546fef7436711e4cfea9a5fb61daaf8.patch";
32 sha256 = "1dpa2jh2kakfaapnqrz03frb67q5fwxzc8c70i6nv1b01i9xw0bn";
33 })
34 ];
35
36 checkInputs = [
37 nose
38 ];
39
40 propagatedBuildInputs = [
41 six
42 ];
43
44 # Fontconfig error: Cannot load default config file
45 preCheck = ''
46 export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
47 '';
48
49 checkPhase = ''
50 runHook preCheck
51
52 nosetests
53
54 runHook postCheck
55 '';
56
57 meta = with lib; {
58 description = "Powerful and Lightweight Python Tree Data Structure";
59 homepage = https://github.com/c0fec0de/anytree;
60 license = licenses.asl20;
61 maintainers = [ maintainers.worldofpeace ];
62 };
63}