1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, dos2unix
6, pythonRelaxDepsHook
7, asn1crypto
8, astunparse
9, bincopy
10, bitstring
11, click
12, click-option-group
13, cmsis-pack-manager
14, commentjson
15, crcmod
16, cryptography
17, deepmerge
18, fastjsonschema
19, hexdump
20, jinja2
21, libusbsio
22, oscrypto
23, pycryptodome
24, pylink-square
25, pyocd
26, pypemicro
27, pyserial
28, ruamel-yaml
29, sly
30, pytestCheckHook
31, voluptuous
32}:
33
34buildPythonPackage rec {
35 pname = "spsdk";
36 version = "1.6.3";
37
38 src = fetchFromGitHub {
39 owner = "NXPmicro";
40 repo = pname;
41 rev = version;
42 sha256 = "sha256-JMhd2XdbjEN6SUzFgcBHd/dStiuYeXXis6pfijSfUso=";
43 };
44
45 patches = [
46 # https://github.com/NXPmicro/spsdk/pull/43
47 (fetchpatch {
48 name = "cryptography-37-compat.patch";
49 url = "https://github.com/NXPmicro/spsdk/commit/a85b854de1093de593d27fa64de442224ab2e0fd.patch";
50 sha256 = "sha256-4pXV/8RaNuGl7KNdoGD/8YnPQ2ZmUQOjXWA/Yy0Kxu8=";
51 })
52 # https://github.com/NXPmicro/spsdk/pull/41
53 (fetchpatch {
54 name = "blhost-click-8-1-compat.patch";
55 url = "https://github.com/NXPmicro/spsdk/commit/5112b1b69aa681d265035475e73d28ea0c8cb6ab.patch";
56 sha256 = "sha256-Okz6Er6OVuAA5IlB5IabSa/gUSLa+E2Ltd+J3uoIg6o=";
57 })
58 ];
59
60 nativeBuildInputs = [ pythonRelaxDepsHook ];
61 pythonRelaxDeps = [
62 "cmsis-pack-manager"
63 "cryptography"
64 "deepmerge"
65 "jinja2"
66 "pylink-square"
67 "pyocd"
68 ];
69 pythonRemoveDeps = [ "pyocd-pemicro" ];
70
71 propagatedBuildInputs = [
72 asn1crypto
73 astunparse
74 bincopy
75 bitstring
76 click
77 click-option-group
78 cmsis-pack-manager
79 commentjson
80 crcmod
81 cryptography
82 deepmerge
83 fastjsonschema
84 hexdump
85 jinja2
86 libusbsio
87 oscrypto
88 pycryptodome
89 pylink-square
90 pyocd
91 pypemicro
92 pyserial
93 ruamel-yaml
94 sly
95 ];
96
97 checkInputs = [
98 pytestCheckHook
99 voluptuous
100 ];
101
102 disabledTests = [
103 # tests also fail on debian, so presumable they are broken
104 "test_elftosb_mbi_signed"
105 "test_elftosb_sb31"
106 ];
107
108 pythonImportsCheck = [ "spsdk" ];
109
110 meta = with lib; {
111 description = "NXP Secure Provisioning SDK";
112 homepage = "https://github.com/NXPmicro/spsdk";
113 license = licenses.bsd3;
114 maintainers = with maintainers; [ frogamic sbruder ];
115 };
116}