2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
snap7,
|
|
|
|
fetchFromGitHub,
|
|
|
|
setuptools,
|
|
|
|
pythonOlder,
|
2022-06-16 17:23:12 +00:00
|
|
|
}:
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-snap7";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "1.3";
|
2022-06-16 17:23:12 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.6";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gijzelaerr";
|
|
|
|
repo = "python-snap7";
|
2022-06-16 17:23:12 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2023-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-90WwgqPHsHbuQUY49cSQblN1jfoLydiG0dm1aMF/NCA=";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ setuptools ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace snap7/common.py \
|
|
|
|
--replace "lib_location = None" "lib_location = '${snap7}/lib/libsnap7.so'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Tests require root privileges to open privilaged ports
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"snap7"
|
|
|
|
"snap7.util"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
description = "Python wrapper for the snap7 PLC communication library";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "snap7-server";
|
2020-09-25 04:45:31 +00:00
|
|
|
homepage = "https://github.com/gijzelaerr/python-snap7";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ freezeboy ];
|
|
|
|
};
|
|
|
|
}
|