1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 replaceVars,
7 setuptools,
8 libusb1,
9 pytestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "libusb1";
14 version = "3.3.1";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "vpelletier";
19 repo = "python-libusb1";
20 tag = version;
21 hash = "sha256-nytxew6KogpEpSnRtmY0UNH+07x0k0XLZ/MRC9NSpDg=";
22 };
23
24 patches = [
25 (replaceVars ./ctypes.patch {
26 libusb = "${lib.getLib libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}";
27 })
28 ];
29
30 build-system = [ setuptools ];
31
32 buildInputs = [ libusb1 ];
33
34 nativeCheckInputs = [ pytestCheckHook ];
35
36 enabledTestPaths = [ "usb1/testUSB1.py" ];
37
38 meta = with lib; {
39 homepage = "https://github.com/vpelletier/python-libusb1";
40 description = "Python ctype-based wrapper around libusb1";
41 license = licenses.lgpl2Plus;
42 maintainers = with maintainers; [
43 prusnak
44 rnhmjoj
45 ];
46 };
47}