1{ lib
2, buildPythonPackage
3, fetchPypi
4, libftdi1
5, libusb1
6, pythonOlder
7}:
8
9buildPythonPackage rec {
10 pname = "pylibftdi";
11 version = "0.21.0";
12 format = "setuptools";
13
14 disabled = pythonOlder "3.7";
15
16 src = fetchPypi {
17 inherit pname version;
18 hash = "sha256-634vUFKFJUf0xsRgIqFmX510U0OWORcereVv3ICliDI=";
19 };
20
21 propagatedBuildInputs = [
22 libftdi1
23 libusb1
24 ];
25
26 postPatch = ''
27 substituteInPlace src/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 description = "Wrapper to Intra2net's libftdi driver for FTDI's USB devices";
38 homepage = "https://pylibftdi.readthedocs.io/";
39 changelog = "https://github.com/codedstructure/pylibftdi/blob/${version}0/CHANGES.txt";
40 license = licenses.mit;
41 maintainers = with maintainers; [ matthuszagh ];
42 };
43}