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