1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 async-timeout,
12 bellows,
13 click,
14 coloredlogs,
15 crc,
16 libgpiod,
17 typing-extensions,
18 zigpy,
19
20 # tests
21 pytestCheckHook,
22 pytest-asyncio,
23 pytest-mock,
24 pytest-timeout,
25}:
26
27buildPythonPackage rec {
28 pname = "universal-silabs-flasher";
29 version = "0.0.21";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "NabuCasa";
34 repo = "universal-silabs-flasher";
35 rev = "refs/tags/v${version}";
36 hash = "sha256-KZE22S6d+XCnGzdFDJdsbt9HnpnyvH+8p89wPUmLDGc=";
37 };
38
39 postPatch = ''
40 substituteInPlace pyproject.toml \
41 --replace-fail '"setuptools-git-versioning<2"' "" \
42 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
43 '';
44
45
46 build-system = [ setuptools ];
47
48 pythonRelaxDeps = [
49 # https://github.com/NabuCasa/universal-silabs-flasher/pull/50
50 "gpiod"
51 ];
52
53 propagatedBuildInputs = [
54 async-timeout
55 bellows
56 click
57 coloredlogs
58 crc
59 typing-extensions
60 zigpy
61 ] ++ lib.optionals (stdenv.hostPlatform.isLinux) [ libgpiod ];
62
63 nativeCheckInputs = [
64 pytestCheckHook
65 pytest-asyncio
66 pytest-mock
67 pytest-timeout
68 ];
69
70 pythonImportsCheck = [ "universal_silabs_flasher" ];
71
72 meta = with lib; {
73 changelog = "https://github.com/NabuCasa/universal-silabs-flasher/releases/tag/v${version}";
74 description = "Flashes Silicon Labs radios running EmberZNet or CPC multi-pan firmware";
75 mainProgram = "universal-silabs-flasher";
76 homepage = "https://github.com/NabuCasa/universal-silabs-flasher";
77 license = licenses.gpl3Only;
78 maintainers = with maintainers; [ hexa ];
79 };
80}