1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 jsonschema,
7 pythonOlder,
8 rfc3987,
9 ruamel-yaml,
10 setuptools-scm,
11 libfdt,
12}:
13
14buildPythonPackage rec {
15 pname = "dtschema";
16 version = "2024.02";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "devicetree-org";
23 repo = "dt-schema";
24 rev = "refs/tags/v${version}";
25 sha256 = "sha256-UJU8b9BzuuUSHRjnA6hOd1bMPNOlk4LNtrQV5aZmGhI=";
26 };
27
28 patches = [
29 # Change name of pylibfdt to libfdt
30 ./fix_libfdt_name.patch
31 ];
32
33 nativeBuildInputs = [ setuptools-scm ];
34
35 propagatedBuildInputs = [
36 jsonschema
37 rfc3987
38 ruamel-yaml
39 libfdt
40 ];
41
42 # Module has no tests
43 doCheck = false;
44
45 pythonImportsCheck = [ "dtschema" ];
46
47 meta = with lib; {
48 description = "Tooling for devicetree validation using YAML and jsonschema";
49 homepage = "https://github.com/devicetree-org/dt-schema/";
50 changelog = "https://github.com/devicetree-org/dt-schema/releases/tag/v${version}";
51 license = with licenses; [
52 bsd2 # or
53 gpl2Only
54 ];
55 maintainers = with maintainers; [ sorki ];
56
57 broken = (
58 # Library not loaded: @rpath/libfdt.1.dylib
59 stdenv.isDarwin
60 ||
61
62 # see https://github.com/devicetree-org/dt-schema/issues/108
63 versionAtLeast jsonschema.version "4.18"
64 );
65 };
66}