about summary refs log tree commit diff
path: root/pkgs/development/python-modules/zha/default.nix
blob: 0987ddfab28340c2904092acee7e62e83bd03ea0 (plain) (blame)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{ lib
, awesomeversion
, bellows
, buildPythonPackage
, fetchFromGitHub
, pyserial
, pyserial-asyncio
, pyserial-asyncio-fast
, pytest-asyncio
, pytest-timeout
, pytest-xdist
, pytestCheckHook
, python-slugify
, pythonOlder
, pythonRelaxDepsHook
, setuptools
, universal-silabs-flasher
, wheel
, zha-quirks
, zigpy
, zigpy-deconz
, zigpy-xbee
, zigpy-zigate
, zigpy-znp
}:

buildPythonPackage rec {
  pname = "zha";
  version = "0.0.8";
  pyproject = true;

  disabled = pythonOlder "3.12";

  src = fetchFromGitHub {
    owner = "zigpy";
    repo = "zha";
    rev = "refs/tags/${version}";
    hash = "sha256-xOaqwgL8NqB3pHNa6U/wextntI5aMivHLaIhSRqvgRU=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail '"setuptools-git-versioning<2"' "" \
      --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
  '';

  pythonRelaxDeps = [
    "bellows"
    "universal-silabs-flasher"
    "zha-quirks"
  ];

  nativeBuildInputs = [
    pythonRelaxDepsHook
  ];

  build-system = [
    setuptools
    wheel
  ];

  dependencies = [
    awesomeversion
    bellows
    pyserial
    pyserial-asyncio
    pyserial-asyncio-fast
    python-slugify
    universal-silabs-flasher
    zha-quirks
    zigpy
    zigpy-deconz
    zigpy-xbee
    zigpy-zigate
    zigpy-znp
  ];

  nativeCheckInputs = [
    pytest-asyncio
    pytest-timeout
    pytest-xdist
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "zha"
  ];

  disabledTests = [
    # Tests are long-running and often keep hanging
    "test_check_available_no_basic_cluster_handler"
    "test_check_available_success"
    "test_check_available_unsuccessful"
    "test_device_counter_sensors"
    "test_device_tracker"
    "test_device_unavailable_skips_entity_polling"
    "test_elec_measurement_sensor_polling"
    "test_electrical_measurement_init"
    "test_group_member_assume_state"
    "test_light_refresh"
    "test_light"
    "test_light"
    "test_light"
    "test_pollers_skip"
    "test_sinope_time"
    "test_siren_timed_off"
    "test_zha_group_light_entity"
  ];

  disabledTestPaths = [
    "tests/test_cluster_handlers.py"
  ];

  pytestFlagsArray = [
    "-v"
    "--timeout=5"
  ];

  meta = with lib; {
    description = "Zigbee Home Automation";
    homepage = "https://github.com/zigpy/zha";
    changelog = "https://github.com/zigpy/zha/releases/tag/${version}";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ fab ];
  };
}