2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, buildPythonPackage, fetchPypi, libusb1, pytest }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "libusb1";
|
2021-10-17 09:34:42 +00:00
|
|
|
version = "2.0.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-10-17 09:34:42 +00:00
|
|
|
sha256 = "d3ba82ecf7ab6a48d21dac6697e26504670cc3522b8e5941bd28fb56cf3f6c46";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
2021-10-17 09:34:42 +00:00
|
|
|
substituteInPlace usb1/_libusb1.py --replace \
|
2020-04-24 23:36:52 +00:00
|
|
|
"ctypes.util.find_library(base_name)" \
|
|
|
|
"'${libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ libusb1 ];
|
|
|
|
|
|
|
|
checkInputs = [ pytest ];
|
|
|
|
|
|
|
|
checkPhase = ''
|
2021-07-14 22:03:04 +00:00
|
|
|
py.test usb1/testUSB1.py
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/vpelletier/python-libusb1";
|
|
|
|
description = "Python ctype-based wrapper around libusb1";
|
|
|
|
license = licenses.lgpl2Plus;
|
2020-12-25 13:55:36 +00:00
|
|
|
maintainers = with maintainers; [ prusnak rnhmjoj ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|