1{
2 lib,
3 async-timeout,
4 buildPythonPackage,
5 cython,
6 dbus,
7 fetchFromGitHub,
8 poetry-core,
9 pytest,
10 pytest-asyncio,
11 pytest-codspeed,
12 pytest-cov-stub,
13 python,
14 pythonOlder,
15 setuptools,
16}:
17
18buildPythonPackage rec {
19 pname = "dbus-fast";
20 version = "2.44.3";
21 pyproject = true;
22
23 disabled = pythonOlder "3.9";
24
25 src = fetchFromGitHub {
26 owner = "Bluetooth-Devices";
27 repo = "dbus-fast";
28 tag = "v${version}";
29 hash = "sha256-ZpTQjAmrLoenDWzd/0NpD7fqTd6Dv1J0Ks0db4twwYk=";
30 };
31
32 postPatch = ''
33 substituteInPlace pyproject.toml \
34 --replace-fail "Cython>=3,<3.1.0" Cython
35 '';
36
37 # The project can build both an optimized cython version and an unoptimized
38 # python version. This ensures we fail if we build the wrong one.
39 env.REQUIRE_CYTHON = 1;
40
41 build-system = [
42 cython
43 poetry-core
44 setuptools
45 ];
46
47 dependencies = [ async-timeout ];
48
49 nativeCheckInputs = [
50 dbus
51 pytest
52 pytest-asyncio
53 pytest-codspeed
54 pytest-cov-stub
55 ];
56
57 pythonImportsCheck = [
58 "dbus_fast"
59 "dbus_fast.aio"
60 "dbus_fast.service"
61 "dbus_fast.message"
62 ];
63
64 checkPhase = ''
65 runHook preCheck
66
67 # test_peer_interface times out
68 dbus-run-session \
69 --config-file=${dbus}/share/dbus-1/session.conf \
70 ${python.interpreter} -m pytest -k "not test_peer_interface"
71
72 runHook postCheck
73 '';
74
75 meta = with lib; {
76 description = "Faster version of dbus-next";
77 homepage = "https://github.com/bluetooth-devices/dbus-fast";
78 changelog = "https://github.com/Bluetooth-Devices/dbus-fast/blob/${src.tag}/CHANGELOG.md";
79 license = licenses.mit;
80 maintainers = with maintainers; [ fab ];
81 };
82}