summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2019-09-28 14:42:45 +0200
committerSam Thursfield <sam@afuera.me.uk>2019-10-02 22:12:11 +0200
commit10c246d6da2ce7a9e60bc168b7d0a08565e1d7b0 (patch)
treec799066fbf849b8e4ade3415b2a71fd295b07aeb
parent7e8af798beea29380c93d2ddd4322b8bd3268642 (diff)
downloadtracker-10c246d6da2ce7a9e60bc168b7d0a08565e1d7b0.tar.gz
utils/trackertestutils: Give better error if dbus-daemon can't be found
We also now use `shutil.which()` to find the binary. This shouldn't change anything as we were already looking in PATH for the binary.
-rw-r--r--utils/trackertestutils/dbusdaemon.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/trackertestutils/dbusdaemon.py b/utils/trackertestutils/dbusdaemon.py
index 796fdc912..abd8c6b02 100644
--- a/utils/trackertestutils/dbusdaemon.py
+++ b/utils/trackertestutils/dbusdaemon.py
@@ -21,6 +21,7 @@ from gi.repository import GLib
import logging
import os
+import shutil
import signal
import subprocess
import threading
@@ -58,8 +59,16 @@ class DBusDaemon:
raise DaemonNotStartedError()
return self._gdbus_connection
+ def _dbus_daemon_path(self):
+ dbus_daemon = shutil.which('dbus-daemon')
+
+ if dbus_daemon is None:
+ raise RuntimeError("Could not find `dbus-daemon` binary in PATH (%s)." % os.environ.get('PATH'))
+
+ return dbus_daemon
+
def start(self, config_file=None, env=None, new_session=False):
- dbus_command = ['dbus-daemon', '--print-address=1', '--print-pid=1']
+ dbus_command = [self._dbus_daemon_path(), '--print-address=1', '--print-pid=1']
if config_file:
dbus_command += ['--config-file=' + config_file]
else: