2024-04-21 15:54:59 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
aiohttp,
|
|
|
|
buildPythonPackage,
|
|
|
|
click,
|
|
|
|
fetchFromGitHub,
|
|
|
|
prompt-toolkit,
|
|
|
|
pygments,
|
|
|
|
pyserial,
|
|
|
|
pytest-asyncio,
|
|
|
|
pytest-xdist,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
redis,
|
|
|
|
setuptools,
|
|
|
|
sqlalchemy,
|
|
|
|
twisted,
|
|
|
|
typer,
|
2021-01-09 10:05:03 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pymodbus";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "3.6.8";
|
2023-10-19 13:55:26 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
disabled = pythonOlder "3.9";
|
2021-01-09 10:05:03 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-02-02 18:25:31 +00:00
|
|
|
owner = "pymodbus-dev";
|
2024-04-21 15:54:59 +00:00
|
|
|
repo = "pymodbus";
|
2023-01-20 10:41:00 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-6Rt5fbuaeAgbW5KKse1zZIJyq/p2P2MjXGwA7q0C7wA=";
|
2021-01-09 10:05:03 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace-fail "--cov-report html " ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
build-system = [ setuptools ];
|
2023-10-19 13:55:26 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
repl = [
|
|
|
|
aiohttp
|
|
|
|
typer
|
|
|
|
prompt-toolkit
|
|
|
|
pygments
|
|
|
|
click
|
|
|
|
] ++ typer.optional-dependencies.all;
|
2024-04-21 15:54:59 +00:00
|
|
|
serial = [ pyserial ];
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-01-20 10:41:00 +00:00
|
|
|
pytest-asyncio
|
2023-02-02 18:25:31 +00:00
|
|
|
pytest-xdist
|
2021-01-09 10:05:03 +00:00
|
|
|
pytestCheckHook
|
|
|
|
redis
|
|
|
|
sqlalchemy
|
|
|
|
twisted
|
2023-10-09 19:29:22 +00:00
|
|
|
] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
preCheck = ''
|
|
|
|
pushd test
|
|
|
|
'';
|
|
|
|
|
|
|
|
postCheck = ''
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
pythonImportsCheck = [ "pymodbus" ];
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
disabledTests =
|
|
|
|
[
|
|
|
|
# Tests often hang
|
|
|
|
"test_connected"
|
|
|
|
]
|
|
|
|
++ lib.optionals (lib.versionAtLeast aiohttp.version "3.9.0") [
|
|
|
|
"test_split_serial_packet"
|
|
|
|
"test_serial_poll"
|
|
|
|
"test_simulator"
|
|
|
|
];
|
2021-01-09 10:05:03 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python implementation of the Modbus protocol";
|
|
|
|
longDescription = ''
|
|
|
|
Pymodbus is a full Modbus protocol implementation using twisted,
|
|
|
|
torndo or asyncio for its asynchronous communications core. It can
|
|
|
|
also be used without any third party dependencies if a more
|
|
|
|
lightweight project is needed.
|
|
|
|
'';
|
2023-02-02 18:25:31 +00:00
|
|
|
homepage = "https://github.com/pymodbus-dev/pymodbus";
|
|
|
|
changelog = "https://github.com/pymodbus-dev/pymodbus/releases/tag/v${version}";
|
2021-01-09 10:05:03 +00:00
|
|
|
license = with licenses; [ bsd3 ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "pymodbus.simulator";
|
2021-01-09 10:05:03 +00:00
|
|
|
};
|
|
|
|
}
|