diff --git a/pkgs/development/python-modules/libusbsio/default.nix b/pkgs/development/python-modules/libusbsio/default.nix new file mode 100644 index 000000000000..b6cab59570b9 --- /dev/null +++ b/pkgs/development/python-modules/libusbsio/default.nix @@ -0,0 +1,34 @@ +{ lib, buildPythonPackage, libusbsio }: + +buildPythonPackage rec { + pname = "libusbsio"; + inherit (libusbsio) version; + + src = "${libusbsio.src}/python"; + + # The source includes both the python module directly and also a source tarball for it. + # The direct files lack setup information, the tarball includes unwanted binaries. + # This takes only the setup files from the tarball. + postUnpack = '' + tar -C python --strip-components=1 -xf python/dist/libusbsio-${version}.tar.gz libusbsio-${version}/{setup.py,setup.cfg,pyproject.toml} + rm -r python/dist + ''; + + postPatch = '' + 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 = with lib; { + description = "NXP Secure Provisioning SDK"; + homepage = "https://github.com/NXPmicro/spsdk"; + license = licenses.bsd3; + maintainers = with maintainers; [ frogamic sbruder ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b6cc1b7db6b1..b89cd79705ff 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5128,6 +5128,10 @@ in { inherit (pkgs) libusb1; }; + libusbsio = callPackage ../development/python-modules/libusbsio { + inherit (pkgs) libusbsio; + }; + libversion = callPackage ../development/python-modules/libversion { inherit (pkgs) libversion; };