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