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