1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 nose, 6 dbus, 7 gobject-introspection, 8 dbus-python, 9 pygobject3, 10 bluez, 11 networkmanager, 12 setuptools-scm, 13 runCommand, 14}: 15 16let 17 # Cannot just add it to path in preCheck since that attribute will be passed to 18 # mkDerivation even with doCheck = false, causing a dependency cycle. 19 pbap-client = runCommand "pbap-client" { } '' 20 mkdir -p "$out/bin" 21 ln -s "${bluez.test}/test/pbap-client" "$out/bin/pbap-client" 22 ''; 23in 24buildPythonPackage rec { 25 pname = "python-dbusmock"; 26 version = "0.31.1"; 27 format = "setuptools"; 28 29 src = fetchFromGitHub { 30 owner = "martinpitt"; 31 repo = pname; 32 rev = "refs/tags/${version}"; 33 hash = "sha256-DdV78o089Jkc7mSsGvlJgVpv8kPpMILo7lC6EbLxkxg="; 34 }; 35 36 nativeBuildInputs = [ setuptools-scm ]; 37 38 propagatedBuildInputs = [ dbus-python ]; 39 40 nativeCheckInputs = [ 41 dbus 42 gobject-introspection 43 pygobject3 44 bluez 45 pbap-client 46 networkmanager 47 nose 48 ]; 49 50 # TODO: Get the rest of these tests running? 51 NOSE_EXCLUDE = lib.concatStringsSep "," [ 52 "test_bluez4" # NixOS ships BlueZ5 53 # These appear to fail because they're expecting to run in an Ubuntu chroot? 54 "test_everything" # BlueZ5 OBEX 55 "test_polkitd" 56 "test_consolekit" 57 "test_api" 58 "test_logind" 59 "test_notification_daemon" 60 "test_ofono" 61 "test_gnome_screensaver" 62 "test_cli" 63 "test_timedated" 64 "test_upower" 65 # needs glib 66 "test_accounts_service" 67 # needs dbus-daemon active 68 "test_systemd" 69 # Very slow, consider disabling? 70 # "test_networkmanager" 71 ]; 72 73 checkPhase = '' 74 runHook preCheck 75 nosetests -v 76 runHook postCheck 77 ''; 78 79 meta = with lib; { 80 description = "Mock D-Bus objects for tests"; 81 homepage = "https://github.com/martinpitt/python-dbusmock"; 82 license = licenses.lgpl3Plus; 83 maintainers = with maintainers; [ callahad ]; 84 platforms = platforms.linux; 85 }; 86}