1{ lib
2, async-timeout
3, bluez
4, buildPythonPackage
5, dbus-fast
6, fetchFromGitHub
7, poetry-core
8, pytest-asyncio
9, pytestCheckHook
10, pythonOlder
11, typing-extensions
12}:
13
14buildPythonPackage rec {
15 pname = "bleak";
16 version = "0.21.1";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "hbldh";
23 repo = pname;
24 rev = "refs/tags/v${version}";
25 hash = "sha256-T0im8zKyNLbskAEDeUUFS/daJtvttlHlttjscqP8iSk=";
26 };
27
28 postPatch = ''
29 # bleak checks BlueZ's version with a call to `bluetoothctl --version`
30 substituteInPlace bleak/backends/bluezdbus/version.py \
31 --replace \"bluetoothctl\" \"${bluez}/bin/bluetoothctl\"
32 '';
33
34 nativeBuildInputs = [
35 poetry-core
36 ];
37
38 propagatedBuildInputs = [
39 async-timeout
40 dbus-fast
41 typing-extensions
42 ];
43
44 nativeCheckInputs = [
45 pytest-asyncio
46 pytestCheckHook
47 ];
48
49 pythonImportsCheck = [
50 "bleak"
51 ];
52
53 meta = with lib; {
54 description = "Bluetooth Low Energy platform agnostic client";
55 homepage = "https://github.com/hbldh/bleak";
56 changelog = "https://github.com/hbldh/bleak/blob/v${version}/CHANGELOG.rst";
57 license = licenses.mit;
58 platforms = platforms.linux;
59 maintainers = with maintainers; [ oxzi ];
60 };
61}