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