1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 libusbsio,
6}:
7
8buildPythonPackage rec {
9 pname = "libusbsio";
10 format = "setuptools";
11 version = "2.1.13";
12 # If the versions come back into sync switch back to inheriting from c lib
13 # inherit (libusbsio) version;
14
15 src = fetchPypi {
16 inherit pname version;
17 hash = "sha256-3xudSyqfXq3wsFdOgBeGK1nSY0NZjx9UhmTqbQGXWyU=";
18 };
19
20 # The source includes both the python module directly and also prebuilt binaries
21 # Delete the binaries and patch the wrapper to use binary from Nixpkgs instead
22 postPatch = ''
23 rm -rf libusbsio/bin
24 substituteInPlace libusbsio/libusbsio.py \
25 --replace "dllpath = LIBUSBSIO._lookup_dll_path(dfltdir, dllname)" 'dllpath = "${libusbsio}/lib/" + dllname'
26 '';
27
28 buildInputs = [ libusbsio ];
29
30 doCheck = false; # they require a device to be connected over USB
31
32 pythonImportsCheck = [ "libusbsio" ];
33
34 meta = with lib; {
35 description = "LIBUSBSIO Host Library for USB Enabled MCUs";
36 homepage = "https://www.nxp.com/design/design-center/software/development-software/libusbsio-host-library-for-usb-enabled-mcus:LIBUSBSIO";
37 license = licenses.bsd3;
38 maintainers = with maintainers; [
39 frogamic
40 sbruder
41 ];
42 };
43}