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