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