1{
2 lib,
3 awesomeversion,
4 bellows,
5 buildPythonPackage,
6 fetchFromGitHub,
7 pyserial,
8 pyserial-asyncio,
9 pyserial-asyncio-fast,
10 pytest-asyncio,
11 pytest-timeout,
12 pytest-xdist,
13 pytestCheckHook,
14 python-slugify,
15 pythonOlder,
16 pythonRelaxDepsHook,
17 setuptools,
18 universal-silabs-flasher,
19 wheel,
20 zha-quirks,
21 zigpy,
22 zigpy-deconz,
23 zigpy-xbee,
24 zigpy-zigate,
25 zigpy-znp,
26}:
27
28buildPythonPackage rec {
29 pname = "zha";
30 version = "0.0.8";
31 pyproject = true;
32
33 disabled = pythonOlder "3.12";
34
35 src = fetchFromGitHub {
36 owner = "zigpy";
37 repo = "zha";
38 rev = "refs/tags/${version}";
39 hash = "sha256-xOaqwgL8NqB3pHNa6U/wextntI5aMivHLaIhSRqvgRU=";
40 };
41
42 postPatch = ''
43 substituteInPlace pyproject.toml \
44 --replace-fail '"setuptools-git-versioning<2"' "" \
45 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
46 '';
47
48 pythonRelaxDeps = [
49 "bellows"
50 "universal-silabs-flasher"
51 "zha-quirks"
52 ];
53
54 nativeBuildInputs = [ pythonRelaxDepsHook ];
55
56 build-system = [
57 setuptools
58 wheel
59 ];
60
61 dependencies = [
62 awesomeversion
63 bellows
64 pyserial
65 pyserial-asyncio
66 pyserial-asyncio-fast
67 python-slugify
68 universal-silabs-flasher
69 zha-quirks
70 zigpy
71 zigpy-deconz
72 zigpy-xbee
73 zigpy-zigate
74 zigpy-znp
75 ];
76
77 nativeCheckInputs = [
78 pytest-asyncio
79 pytest-timeout
80 pytest-xdist
81 pytestCheckHook
82 ];
83
84 pythonImportsCheck = [ "zha" ];
85
86 disabledTests = [
87 # Tests are long-running and often keep hanging
88 "test_check_available_no_basic_cluster_handler"
89 "test_check_available_success"
90 "test_check_available_unsuccessful"
91 "test_device_counter_sensors"
92 "test_device_tracker"
93 "test_device_unavailable_skips_entity_polling"
94 "test_elec_measurement_sensor_polling"
95 "test_electrical_measurement_init"
96 "test_group_member_assume_state"
97 "test_light_refresh"
98 "test_light"
99 "test_light"
100 "test_light"
101 "test_pollers_skip"
102 "test_sinope_time"
103 "test_siren_timed_off"
104 "test_zha_group_light_entity"
105 ];
106
107 disabledTestPaths = [ "tests/test_cluster_handlers.py" ];
108
109 pytestFlagsArray = [
110 "-v"
111 "--timeout=5"
112 ];
113
114 meta = with lib; {
115 description = "Zigbee Home Automation";
116 homepage = "https://github.com/zigpy/zha";
117 changelog = "https://github.com/zigpy/zha/releases/tag/${version}";
118 license = licenses.gpl3Only;
119 maintainers = with maintainers; [ fab ];
120 };
121}