1{
2 lib,
3 fetchFromGitHub,
4 fetchpatch,
5 buildPythonPackage,
6 setuptools,
7 pyusb,
8 pymodbus,
9 pyserial-asyncio,
10 pytestCheckHook,
11 pytest-asyncio,
12}:
13
14buildPythonPackage rec {
15 pname = "python-dali";
16 version = "0.11";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "sde1000";
21 repo = "python-dali";
22 tag = "v${version}";
23 hash = "sha256-F/D0wyMVCUaL2SCdPKvnGS22tSgDnvUh6rs2ToKON2c=";
24 };
25
26 patches = [
27 # pymodbus 3.x support
28 (fetchpatch {
29 url = "https://github.com/sde1000/python-dali/commit/fe85b8fd9a746d16a03de8fd8c643ef4254d1ccd.patch";
30 hash = "sha256-bcfr948g7M6m3AQVArcYw9a22jA5eMim+J58iKci55s=";
31 })
32 ];
33
34 build-system = [ setuptools ];
35
36 optional-dependencies = {
37 driver-unipi = [
38 pyusb
39 pymodbus
40 ];
41 driver-serial = [ pyserial-asyncio ];
42 };
43
44 nativeCheckInputs = [
45 pytestCheckHook
46 pytest-asyncio
47 ]
48 ++ lib.flatten (lib.attrValues optional-dependencies);
49
50 pythonImportsCheck = [ "dali" ];
51
52 meta = {
53 description = "IEC 62386 (DALI) lighting control library";
54 homepage = "https://github.com/sde1000/python-dali";
55 license = lib.licenses.lgpl3Plus;
56 maintainers = with lib.maintainers; [ sikmir ];
57 };
58}