1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 graphviz,
6
7 # build-system
8 pdm-backend,
9
10 # tests
11 pytest-cov-stub,
12 pytestCheckHook,
13 pyyaml,
14 test2ref,
15 fontconfig,
16}:
17
18buildPythonPackage rec {
19 pname = "anytree";
20 version = "2.13.0";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "c0fec0de";
25 repo = "anytree";
26 tag = version;
27 hash = "sha256-kFNYJMWagpqixs84+AaNkh/28asLBJhibTP8LEEe4XY=";
28 };
29
30 postPatch = ''
31 substituteInPlace src/anytree/exporter/dotexporter.py \
32 --replace-fail \
33 'cmd = ["dot"' \
34 'cmd = ["${lib.getExe' graphviz "dot"}"'
35 '';
36
37 build-system = [ pdm-backend ];
38
39 nativeCheckInputs = [
40 pytest-cov-stub
41 pytestCheckHook
42 pyyaml
43 test2ref
44 ];
45
46 # Tests print “Fontconfig error: Cannot load default config file”
47 preCheck = ''
48 export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
49 '';
50
51 pythonImportsCheck = [ "anytree" ];
52
53 meta = {
54 description = "Powerful and Lightweight Python Tree Data Structure";
55 homepage = "https://github.com/c0fec0de/anytree";
56 changelog = "https://github.com/c0fec0de/anytree/releases/tag/${version}";
57 license = lib.licenses.asl20;
58 maintainers = with lib.maitnainers; [ ];
59 };
60}