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