1{
2 lib,
3 buildPythonPackage,
4 connio,
5 fetchFromGitHub,
6 fetchpatch,
7 pytest-asyncio,
8 pytest-cov-stub,
9 pytestCheckHook,
10 pythonOlder,
11 setuptools,
12 umodbus,
13}:
14
15buildPythonPackage rec {
16 pname = "async-modbus";
17 version = "0.2.2";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "tiagocoutinho";
24 repo = "async_modbus";
25 tag = "v${version}";
26 hash = "sha256-xms2OfX5bHPXswwhLhyh6HFsm1YqDwKclUirxrgL4i0=";
27 };
28
29 patches = [
30 (fetchpatch {
31 # Fix tests; https://github.com/tiagocoutinho/async_modbus/pull/13
32 url = "https://github.com/tiagocoutinho/async_modbus/commit/d81d8ffe94870f0f505e0c8a0694768c98053ecc.patch";
33 hash = "sha256-mG3XO2nAFYitatkswU7er29BJc/A0IL1rL2Zu4daZ7k=";
34 })
35 ];
36
37 postPatch = ''
38 substituteInPlace pyproject.toml \
39 --replace '"--durations=2", "--verbose"' ""
40 '';
41
42 nativeBuildInputs = [ setuptools ];
43
44 propagatedBuildInputs = [
45 connio
46 umodbus
47 ];
48
49 nativeCheckInputs = [
50 pytest-asyncio
51 pytest-cov-stub
52 pytestCheckHook
53 ];
54
55 pythonImportsCheck = [ "async_modbus" ];
56
57 meta = with lib; {
58 description = "Library for Modbus communication";
59 homepage = "https://github.com/tiagocoutinho/async_modbus";
60 license = with licenses; [ gpl3Plus ];
61 maintainers = with maintainers; [ fab ];
62 };
63}