1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8 setuptools-scm,
9
10 # dependencies
11 asn1crypto,
12 bincopy,
13 bitstring,
14 click,
15 click-command-tree,
16 click-option-group,
17 colorama,
18 crcmod,
19 cryptography,
20 deepmerge,
21 fastjsonschema,
22 filelock,
23 hexdump,
24 libusbsio,
25 libuuu,
26 oscrypto,
27 packaging,
28 platformdirs,
29 prettytable,
30 pyasn1,
31 pyocd,
32 pyserial,
33 requests,
34 ruamel-yaml,
35 sly,
36 spsdk-mcu-link,
37 spsdk-pyocd,
38 typing-extensions,
39 x690,
40
41 # tests
42 ipykernel,
43 pytest-notebook,
44 pytestCheckHook,
45 voluptuous,
46 versionCheckHook,
47 writableTmpDirAsHomeHook,
48}:
49
50buildPythonPackage rec {
51 pname = "spsdk";
52 version = "2.6.1";
53 pyproject = true;
54
55 src = fetchFromGitHub {
56 owner = "nxp-mcuxpresso";
57 repo = "spsdk";
58 tag = "v${version}";
59 hash = "sha256-AdW19Zf5TZ6hChXbW9dLGcMpFTQOT1wrPzEqaSfWzDE=";
60 };
61
62 postPatch = ''
63 substituteInPlace pyproject.toml \
64 --replace-fail "setuptools>=72.1,<74" "setuptools" \
65 --replace-fail "setuptools_scm<8.2" "setuptools_scm"
66 '';
67
68 build-system = [
69 setuptools
70 setuptools-scm
71 ];
72
73 pythonRelaxDeps = [
74 "cryptography"
75 "filelock"
76 "importlib-metadata"
77 "packaging"
78 "prettytable"
79 "requests"
80 "setuptools_scm"
81 "typing-extensions"
82 ];
83
84 pythonRemoveDeps = [
85 # Remove unneeded unfree package. pyocd-pemicro is only used when
86 # generating a pyinstaller package, which we don't do.
87 "pyocd-pemicro"
88 ];
89
90 dependencies = [
91 asn1crypto
92 bincopy
93 bitstring
94 click
95 click-command-tree
96 click-option-group
97 colorama
98 crcmod
99 cryptography
100 deepmerge
101 fastjsonschema
102 filelock
103 hexdump
104 libusbsio
105 libuuu
106 oscrypto
107 packaging
108 platformdirs
109 prettytable
110 pyasn1
111 pyocd
112 pyserial
113 requests
114 ruamel-yaml
115 sly
116 spsdk-mcu-link
117 spsdk-pyocd
118 typing-extensions
119 x690
120 ];
121
122 pythonImportsCheck = [ "spsdk" ];
123
124 nativeCheckInputs = [
125 ipykernel
126 pytest-notebook
127 pytestCheckHook
128 voluptuous
129 versionCheckHook
130 writableTmpDirAsHomeHook
131 ];
132 versionCheckProgramArg = "--version";
133
134 disabledTests = [
135 # Missing rotk private key
136 "test_general_notebooks"
137 ];
138
139 meta = {
140 changelog = "https://github.com/nxp-mcuxpresso/spsdk/blob/v${version}/docs/release_notes.rst";
141 description = "NXP Secure Provisioning SDK";
142 homepage = "https://github.com/nxp-mcuxpresso/spsdk";
143 license = lib.licenses.bsd3;
144 maintainers = with lib.maintainers; [
145 frogamic
146 sbruder
147 ];
148 mainProgram = "spsdk";
149 };
150}