1{ lib, stdenv, buildPythonPackage, fetchPypi, libusb1, pytestCheckHook }:
2
3buildPythonPackage rec {
4 pname = "libusb1";
5 version = "2.0.1";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "d3ba82ecf7ab6a48d21dac6697e26504670cc3522b8e5941bd28fb56cf3f6c46";
10 };
11
12 postPatch = ''
13 substituteInPlace usb1/_libusb1.py --replace \
14 "ctypes.util.find_library(base_name)" \
15 "'${libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}'"
16 '';
17
18 buildInputs = [ libusb1 ];
19
20 checkInputs = [ pytestCheckHook ];
21
22 pytestFlagsArray = [
23 "usb1/testUSB1.py"
24 ];
25
26 meta = with lib; {
27 homepage = "https://github.com/vpelletier/python-libusb1";
28 description = "Python ctype-based wrapper around libusb1";
29 license = licenses.lgpl2Plus;
30 maintainers = with maintainers; [ prusnak rnhmjoj ];
31 };
32}