diff options
author | Petri Gynther <pgynther@google.com> | 2014-01-17 17:45:07 -0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-01-18 00:38:39 -0800 |
commit | 7adf8d09b4ba060ecb223e36fd6678aa52ab0af1 (patch) | |
tree | e31bb33a1ccf5460c74ce7fb48bc7c03a04401d0 /test/pbap-client | |
parent | d715a2ee3ccf4b9f915b16cb138bfdabe4858581 (diff) | |
download | bluez-7adf8d09b4ba060ecb223e36fd6678aa52ab0af1.tar.gz |
test: Python import cleanup
Some test scripts use "from gi.repository import GObject" whereas others
use "import gobject". gi.repository is not always available on embedded
systems, so convert all instances to this format:
try:
from gi.repository import GObject
except ImportError:
import gobject as GObject
Also, sort the imports in this order: system, dbus, gobject, bluezutils
Diffstat (limited to 'test/pbap-client')
-rwxr-xr-x | test/pbap-client | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/pbap-client b/test/pbap-client index c02833bd7..51e26ebda 100755 --- a/test/pbap-client +++ b/test/pbap-client @@ -2,13 +2,15 @@ from __future__ import absolute_import, print_function, unicode_literals -import gobject - -import sys import os +import sys import dbus import dbus.service import dbus.mainloop.glib +try: + from gi.repository import GObject +except ImportError: + import gobject as GObject BUS_NAME='org.bluez.obex' PATH = '/org/bluez/obex' @@ -113,7 +115,7 @@ if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) bus = dbus.SessionBus() - mainloop = gobject.MainLoop() + mainloop = GObject.MainLoop() client = dbus.Interface(bus.get_object(BUS_NAME, PATH), CLIENT_INTERFACE) |