1{
2 lib,
3 buildPythonPackage,
4 libusbsio,
5}:
6
7buildPythonPackage rec {
8 pname = "libusbsio";
9 format = "setuptools";
10 inherit (libusbsio) version;
11
12 src = "${libusbsio.src}/python";
13
14 # The source includes both the python module directly and also a source tarball for it.
15 # The direct files lack setup information, the tarball includes unwanted binaries.
16 # This takes only the setup files from the tarball.
17 postUnpack = ''
18 tar -C python --strip-components=1 -xf python/dist/libusbsio-${version}.tar.gz libusbsio-${version}/{setup.py,setup.cfg,pyproject.toml}
19 rm -r python/dist
20 '';
21
22 postPatch = ''
23 substituteInPlace libusbsio/libusbsio.py \
24 --replace "dllpath = LIBUSBSIO._lookup_dll_path(dfltdir, dllname)" 'dllpath = "${libusbsio}/lib/" + dllname'
25 '';
26
27 buildInputs = [ libusbsio ];
28
29 doCheck = false; # they require a device to be connected over USB
30
31 pythonImportsCheck = [ "libusbsio" ];
32
33 meta = with lib; {
34 description = "NXP Secure Provisioning SDK";
35 homepage = "https://github.com/NXPmicro/spsdk";
36 license = licenses.bsd3;
37 maintainers = with maintainers; [
38 frogamic
39 sbruder
40 ];
41 };
42}