summaryrefslogtreecommitdiff
path: root/test/simple-obex-agent
diff options
context:
space:
mode:
authorPetri Gynther <pgynther@google.com>2014-01-17 17:45:07 -0800
committerMarcel Holtmann <marcel@holtmann.org>2014-01-18 00:38:39 -0800
commit7adf8d09b4ba060ecb223e36fd6678aa52ab0af1 (patch)
treee31bb33a1ccf5460c74ce7fb48bc7c03a04401d0 /test/simple-obex-agent
parentd715a2ee3ccf4b9f915b16cb138bfdabe4858581 (diff)
downloadbluez-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/simple-obex-agent')
-rwxr-xr-xtest/simple-obex-agent8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/simple-obex-agent b/test/simple-obex-agent
index f15e9d1d6..05ec4eda7 100755
--- a/test/simple-obex-agent
+++ b/test/simple-obex-agent
@@ -2,12 +2,14 @@
from __future__ import absolute_import, print_function, unicode_literals
-import gobject
-
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'
@@ -63,7 +65,7 @@ if __name__ == '__main__':
path = "/test/agent"
agent = Agent(bus, path)
- mainloop = gobject.MainLoop()
+ mainloop = GObject.MainLoop()
manager.RegisterAgent(path)
print("Agent registered")