about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pyads/default.nix
blob: 37d3b31a365c54d3f3f2a113814ab0efdbdcd0b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ adslib, buildPythonPackage, fetchFromGitHub, lib, pytestCheckHook, pytest
, pytestcov, pythonOlder }:

buildPythonPackage rec {
  pname = "pyads";
  version = "3.2.2";

  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = "stlehmann";
    repo = pname;
    rev = version;
    sha256 = "1jd727pw0z73y4xhrykqkfcz1acrpy3rks58lr1y4yilfv11p6jb";
  };

  buildInputs = [ adslib ];
  patchPhase = ''
    substituteInPlace pyads/pyads_ex.py \
      --replace "ctypes.CDLL(adslib)" "ctypes.CDLL(\"${adslib}/lib/adslib.so\")"
  '';
  checkInputs = [ pytestCheckHook pytest pytestcov ];

  meta = with lib; {
    description = "Python wrapper for TwinCAT ADS library";
    homepage = "https://github.com/MrLeeh/pyads";
    license = licenses.mit;
    maintainers = with maintainers; [ jamiemagee ];
  };
}