summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/async-modbus/default.nix
blob: c01af423152a6dace82eb22c568c20007c738db4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
  lib,
  buildPythonPackage,
  connio,
  fetchFromGitHub,
  fetchpatch,
  pytest-asyncio,
  pytest-cov-stub,
  pytestCheckHook,
  setuptools,
  umodbus,
}:

buildPythonPackage rec {
  pname = "async-modbus";
  version = "0.2.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "tiagocoutinho";
    repo = "async_modbus";
    tag = "v${version}";
    hash = "sha256-d4TTs3TtD/9eFdzXBaY+QeAMeRWTvsWeaxONeG0AXJU=";
  };

  patches = [
    (fetchpatch {
      # Fix tests; https://github.com/tiagocoutinho/async_modbus/pull/13
      url = "https://github.com/tiagocoutinho/async_modbus/commit/d81d8ffe94870f0f505e0c8a0694768c98053ecc.patch";
      hash = "sha256-mG3XO2nAFYitatkswU7er29BJc/A0IL1rL2Zu4daZ7k=";
    })
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace '"--durations=2", "--verbose"' ""
  '';

  build-system = [ setuptools ];

  dependencies = [
    connio
    umodbus
  ];

  nativeCheckInputs = [
    pytest-asyncio
    pytest-cov-stub
    pytestCheckHook
  ];

  pythonImportsCheck = [ "async_modbus" ];

  meta = {
    description = "Library for Modbus communication";
    homepage = "https://github.com/tiagocoutinho/async_modbus";
    changelog = "https://github.com/tiagocoutinho/async_modbus/releases/tag/${src.tag}";
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [ fab ];
  };
}