2020-09-25 04:45:31 +00:00
|
|
|
{ lib, buildPythonPackage, snap7, fetchFromGitHub, six, setuptools }:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-snap7";
|
2022-02-10 20:34:41 +00:00
|
|
|
version = "1.1";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gijzelaerr";
|
|
|
|
repo = "python-snap7";
|
2021-04-26 19:14:03 +00:00
|
|
|
rev = version;
|
2022-02-10 20:34:41 +00:00
|
|
|
sha256 = "18z13wb2q5q3msp9w3wddg1byp7picczw4ng8w1ccj4npidxsqv8";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ setuptools six ];
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace snap7/common.py \
|
|
|
|
--replace "lib_location = None" "lib_location = '${snap7}/lib/libsnap7.so'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Tests require root privileges to open privilaged ports
|
|
|
|
# We cannot run them
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"snap7"
|
|
|
|
"snap7.util"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python wrapper for the snap7 PLC communication library ";
|
|
|
|
homepage = "https://github.com/gijzelaerr/python-snap7";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ freezeboy ];
|
|
|
|
};
|
|
|
|
}
|