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 pyocd,
31 pyserial,
32 requests,
33 ruamel-yaml,
34 sly,
35 typing-extensions,
36
37 # tests
38 ipykernel,
39 pytest-notebook,
40 pytestCheckHook,
41 voluptuous,
42 versionCheckHook,
43}:
44
45buildPythonPackage rec {
46 pname = "spsdk";
47 version = "2.4.0";
48 pyproject = true;
49
50 src = fetchFromGitHub {
51 owner = "nxp-mcuxpresso";
52 repo = "spsdk";
53 rev = "refs/tags/v${version}";
54 hash = "sha256-WRR4YyA4HaYoyOZSt/RYivhH2E/20DKLXExWg2yOL48=";
55 };
56
57 postPatch = ''
58 substituteInPlace pyproject.toml \
59 --replace-fail "setuptools>=72.1,<74" "setuptools"
60
61 substituteInPlace setup.py \
62 --replace-fail "setuptools>=72.1,<74" "setuptools"
63 '';
64
65 build-system = [
66 setuptools
67 setuptools-scm
68 ];
69
70 pythonRelaxDeps = [
71 "cryptography"
72 "requests"
73 "packaging"
74 "typing-extensions"
75 ];
76
77 pythonRemoveDeps = [
78 # Remove unneeded unfree package. pyocd-pemicro is only used when
79 # generating a pyinstaller package, which we don't do.
80 "pyocd-pemicro"
81 ];
82
83 dependencies = [
84 asn1crypto
85 bincopy
86 bitstring
87 click
88 click-command-tree
89 click-option-group
90 colorama
91 crcmod
92 cryptography
93 deepmerge
94 fastjsonschema
95 filelock
96 hexdump
97 libusbsio
98 libuuu
99 oscrypto
100 packaging
101 platformdirs
102 prettytable
103 pyocd
104 pyserial
105 requests
106 ruamel-yaml
107 sly
108 typing-extensions
109 ];
110
111 pythonImportsCheck = [ "spsdk" ];
112
113 preInstallCheck = ''
114 export HOME="$(mktemp -d)"
115 '';
116
117 nativeCheckInputs = [
118 ipykernel
119 pytest-notebook
120 pytestCheckHook
121 voluptuous
122 versionCheckHook
123 ];
124 versionCheckProgramArg = [ "--version" ];
125
126 disabledTests = [
127 # Missing rotk private key
128 "test_general_notebooks"
129 ];
130
131 meta = {
132 changelog = "https://github.com/nxp-mcuxpresso/spsdk/blob/v${version}/docs/release_notes.rst";
133 description = "NXP Secure Provisioning SDK";
134 homepage = "https://github.com/nxp-mcuxpresso/spsdk";
135 license = lib.licenses.bsd3;
136 maintainers = with lib.maintainers; [
137 frogamic
138 sbruder
139 ];
140 mainProgram = "spsdk";
141 };
142}