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.31"; 32 pyproject = true; 33 34 src = fetchFromGitHub { 35 owner = "NabuCasa"; 36 repo = "universal-silabs-flasher"; 37 tag = "v${version}"; 38 hash = "sha256-yE6tY0hxslv0nZEX63miegQJHGKD/wp2W4aaj3y74i4="; 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 [ 51 bellows 52 click 53 coloredlogs 54 crc 55 pyserial-asyncio-fast 56 typing-extensions 57 zigpy 58 ] 59 ++ lib.optionals (pythonOlder "3.11") [ async-timeout ] 60 ++ lib.optionals (stdenv.hostPlatform.isLinux) [ libgpiod ]; 61 62 nativeCheckInputs = [ 63 pytestCheckHook 64 pytest-asyncio 65 pytest-mock 66 pytest-timeout 67 ]; 68 69 pythonImportsCheck = [ "universal_silabs_flasher" ]; 70 71 meta = with lib; { 72 changelog = "https://github.com/NabuCasa/universal-silabs-flasher/releases/tag/${src.tag}"; 73 description = "Flashes Silicon Labs radios running EmberZNet or CPC multi-pan firmware"; 74 mainProgram = "universal-silabs-flasher"; 75 homepage = "https://github.com/NabuCasa/universal-silabs-flasher"; 76 license = licenses.gpl3Only; 77 maintainers = with maintainers; [ hexa ]; 78 }; 79}