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