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