1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 runCommand,
7
8 # build-system
9 setuptools,
10 setuptools-scm,
11
12 # dependencies
13 dbus-python,
14
15 # checks
16 dbus,
17 gobject-introspection,
18 pygobject3,
19 bluez,
20 networkmanager,
21 pytestCheckHook,
22}:
23
24let
25 # Cannot just add it to path in preCheck since that attribute will be passed to
26 # mkDerivation even with doCheck = false, causing a dependency cycle.
27 pbap-client = runCommand "pbap-client" { } ''
28 mkdir -p "$out/bin"
29 ln -s "${bluez.test}/test/pbap-client" "$out/bin/pbap-client"
30 '';
31in
32buildPythonPackage rec {
33 pname = "python-dbusmock";
34 version = "0.32.2";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "martinpitt";
39 repo = pname;
40 rev = "refs/tags/${version}";
41 hash = "sha256-TOs6wAZDcSD1eP+Hbj78YXoAtKbReC5di5QSpQdwp8E=";
42 };
43
44 patches = [
45 (fetchpatch {
46 name = "musl.patch";
47 url = "https://github.com/martinpitt/python-dbusmock/commit/1a8d8722068ef7e5f061336047a72d1a0f253b98.patch";
48 hash = "sha256-0j3UXsTMDh1+UolkmoLQXlwHXve81yKiGJ7gDWNZVPY=";
49 })
50 (fetchpatch {
51 name = "os-release.patch";
52 url = "https://github.com/martinpitt/python-dbusmock/commit/4b99cff50e8c741f20aef4527b27ccdb2a4053d2.patch";
53 hash = "sha256-Xcovv44JeuTvPAtXWJvWE+MxlyloClSJGKZz+C3P5bE=";
54 })
55 ];
56
57 build-system = [
58 setuptools
59 setuptools-scm
60 ];
61
62 dependencies = [ dbus-python ];
63
64 nativeCheckInputs = [
65 dbus
66 gobject-introspection
67 pygobject3
68 bluez
69 pbap-client
70 networkmanager
71 pytestCheckHook
72 ];
73
74 disabledTests = [
75 # wants to call upower, which is a reverse-dependency
76 "test_dbusmock_test_template"
77 # Failed to execute program org.TestSystem: No such file or directory
78 "test_system_service_activation"
79 "test_session_service_activation"
80 ];
81
82 meta = with lib; {
83 changelog = "https://github.com/martinpitt/python-dbusmock/releases/tag/${version}";
84 description = "Mock D-Bus objects for tests";
85 homepage = "https://github.com/martinpitt/python-dbusmock";
86 license = licenses.lgpl3Plus;
87 maintainers = with maintainers; [ callahad ];
88 platforms = platforms.linux;
89 };
90}