Commit ec4fc3d3 authored by Fabian Affolter's avatar Fabian Affolter
Browse files

python311Packages.pyads: refactor

parent 36cc5f55
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -4,29 +4,34 @@
, fetchFromGitHub
, pytestCheckHook
, pythonOlder
, setuptools
}:

buildPythonPackage rec {
  pname = "pyads";
  version = "3.4.0";
  format = "setuptools";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "stlehmann";
    repo = pname;
    repo = "pyads";
    rev = "refs/tags/${version}";
    hash = "sha256-HJ/dlRuwFSY5j/mAp6rLMlTV59GFwrTV27n73TWlCUo=";
  };

  build-system = [
    setuptools
  ];

  buildInputs = [
    adslib
  ];

  patchPhase = ''
    substituteInPlace pyads/pyads_ex.py \
      --replace "ctypes.CDLL(adslib)" "ctypes.CDLL(\"${adslib}/lib/adslib.so\")"
      --replace-fail "ctypes.CDLL(adslib)" "ctypes.CDLL(\"${adslib}/lib/adslib.so\")"
  '';

  nativeCheckInputs = [
@@ -40,6 +45,7 @@ buildPythonPackage rec {
  meta = with lib; {
    description = "Python wrapper for TwinCAT ADS library";
    homepage = "https://github.com/MrLeeh/pyads";
    changelog = "https://github.com/stlehmann/pyads/releases/tag/${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ jamiemagee ];
  };