1{ lib
2, buildPythonPackage
3, fetchPypi
4, libftdi1
5, libusb1
6, pythonOlder
7}:
8
9buildPythonPackage rec {
10 pname = "pylibftdi";
11 version = "0.20.0";
12 format = "setuptools";
13
14 disabled = pythonOlder "3.7";
15
16 src = fetchPypi {
17 inherit pname version;
18 sha256 = "f4a87fc4af2c9c7d42badd4192ca9b529f32c9d96fdc8daea7e29c509226df5f";
19 };
20
21 propagatedBuildInputs = [
22 libftdi1
23 libusb1
24 ];
25
26 postPatch = ''
27 substituteInPlace pylibftdi/driver.py \
28 --replace "self._load_library('libusb')" "cdll.LoadLibrary('${libusb1.out}/lib/libusb-1.0.so')" \
29 --replace "self._load_library('libftdi')" "cdll.LoadLibrary('${libftdi1.out}/lib/libftdi1.so')"
30 '';
31
32 pythonImportsCheck = [
33 "pylibftdi"
34 ];
35
36 meta = with lib; {
37 homepage = "https://pylibftdi.readthedocs.io/";
38 description = "Wrapper to Intra2net's libftdi driver for FTDI's USB devices";
39 license = licenses.mit;
40 maintainers = with maintainers; [ matthuszagh ];
41 };
42}