1{ lib
2, adslib
3, buildPythonPackage
4, fetchFromGitHub
5, pytestCheckHook
6, pythonOlder
7}:
8
9buildPythonPackage rec {
10 pname = "pyads";
11 version = "3.3.9";
12 format = "setuptools";
13
14 disabled = pythonOlder "3.7";
15
16 src = fetchFromGitHub {
17 owner = "stlehmann";
18 repo = pname;
19 rev = version;
20 sha256 = "sha256-eNouFJQDgp56fgkA7wZKfosKWOKU6OvXRjFwjCMvZqI=";
21 };
22
23 buildInputs = [
24 adslib
25 ];
26
27 patchPhase = ''
28 substituteInPlace pyads/pyads_ex.py \
29 --replace "ctypes.CDLL(adslib)" "ctypes.CDLL(\"${adslib}/lib/adslib.so\")"
30 '';
31
32 checkInputs = [
33 pytestCheckHook
34 ];
35
36 pythonImportsCheck = [
37 "pyads"
38 ];
39
40 meta = with lib; {
41 description = "Python wrapper for TwinCAT ADS library";
42 homepage = "https://github.com/MrLeeh/pyads";
43 license = licenses.mit;
44 maintainers = with maintainers; [ jamiemagee ];
45 };
46}