1{
2 lib,
3 buildPythonPackage,
4 connio,
5 fetchFromGitHub,
6 fetchpatch,
7 pytest-asyncio,
8 pytestCheckHook,
9 pythonOlder,
10 setuptools,
11 umodbus,
12}:
13
14buildPythonPackage rec {
15 pname = "async-modbus";
16 version = "0.2.1";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "tiagocoutinho";
23 repo = "async_modbus";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-OTt/rUa3KLVSFOIUyMNHnqHvPtISxTposNFAgoixRfk=";
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 '"--cov=async_modbus",' "" \
39 --replace '"--cov-report=html", "--cov-report=term",' "" \
40 --replace '"--durations=2", "--verbose"' ""
41 '';
42
43 nativeBuildInputs = [ setuptools ];
44
45 propagatedBuildInputs = [
46 connio
47 umodbus
48 ];
49
50 nativeCheckInputs = [
51 pytest-asyncio
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}