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/map-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/map-client')
-rwxr-xr-x | test/map-client | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/map-client b/test/map-client index f3c657f73..b9695da66 100755 --- a/test/map-client +++ b/test/map-client @@ -2,15 +2,16 @@ from __future__ import absolute_import, print_function, unicode_literals -import gobject - -import sys +from optparse import OptionParser import os +from pprint import pformat +import sys import dbus import dbus.mainloop.glib -from optparse import OptionParser - -from pprint import pformat +try: + from gi.repository import GObject +except ImportError: + import gobject as GObject BUS_NAME='org.bluez.obex' PATH = '/org/bluez/obex' @@ -185,7 +186,7 @@ if __name__ == '__main__': exit(0) bus = dbus.SessionBus() - mainloop = gobject.MainLoop() + mainloop = GObject.MainLoop() client = dbus.Interface(bus.get_object(BUS_NAME, PATH), CLIENT_INTERFACE) |