summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/libusbsio/default.nix
blob: 4923a764a72ddbbf88896b5e7f78a18a3513675d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  lib,
  buildPythonPackage,
  fetchPypi,
  libusbsio,
}:

buildPythonPackage rec {
  pname = "libusbsio";
  format = "setuptools";
  version = "2.1.13";
  # If the versions come back into sync switch back to inheriting from c lib
  # inherit (libusbsio) version;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-3xudSyqfXq3wsFdOgBeGK1nSY0NZjx9UhmTqbQGXWyU=";
  };

  # The source includes both the python module directly and also prebuilt binaries
  # Delete the binaries and patch the wrapper to use binary from Nixpkgs instead
  postPatch = ''
    rm -rf libusbsio/bin
    substituteInPlace libusbsio/libusbsio.py \
        --replace "dllpath = LIBUSBSIO._lookup_dll_path(dfltdir, dllname)" 'dllpath = "${libusbsio}/lib/" + dllname'
  '';

  buildInputs = [ libusbsio ];

  doCheck = false; # they require a device to be connected over USB

  pythonImportsCheck = [ "libusbsio" ];

  meta = {
    description = "LIBUSBSIO Host Library for USB Enabled MCUs";
    homepage = "https://www.nxp.com/design/design-center/software/development-software/libusbsio-host-library-for-usb-enabled-mcus:LIBUSBSIO";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [
      frogamic
      sbruder
    ];
  };
}