Skip to content

Commit 405f7e7

Browse files
authored
Merge pull request #3425 from cmitu/sixaxis-fix
bluetooth: update python scripts and deps for python3
2 parents 8da6340 + fbc3d1d commit 405f7e7

File tree

4 files changed

+12
-20
lines changed

4 files changed

+12
-20
lines changed

scriptmodules/supplementary/bluetooth.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function _get_connect_mode() {
3838
}
3939

4040
function depends_bluetooth() {
41-
local depends=(bluetooth python-dbus python-gobject bluez-tools)
41+
local depends=(bluetooth python3-dbus python3-gi bluez-tools)
4242
if [[ "$__os_id" == "Raspbian" ]]; then
4343
depends+=(pi-bluetooth raspberrypi-sys-mods)
4444
fi

scriptmodules/supplementary/bluetooth/bluez-simple-agent

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
#!/usr/bin/python
2-
3-
from __future__ import absolute_import, print_function, unicode_literals
1+
#!/usr/bin/python3
42

53
from optparse import OptionParser
64
import sys
75
import dbus
86
import dbus.service
97
import dbus.mainloop.glib
10-
try:
11-
from gi.repository import GObject
12-
except ImportError:
13-
import gobject as GObject
8+
from gi.repository import GLib
9+
1410
import bluezutils
1511

1612
BUS_NAME = 'org.bluez'
@@ -153,7 +149,7 @@ if __name__ == '__main__':
153149
path = "/test/agent"
154150
agent = Agent(bus, path)
155151

156-
mainloop = GObject.MainLoop()
152+
mainloop = GLib.MainLoop()
157153

158154
obj = bus.get_object(BUS_NAME, "/org/bluez");
159155
manager = dbus.Interface(obj, "org.bluez.AgentManager1")

scriptmodules/supplementary/bluetooth/bluez-test-device

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
#!/usr/bin/python
2-
3-
from __future__ import absolute_import, print_function, unicode_literals
1+
#!/usr/bin/python3
42

53
from optparse import OptionParser, make_option
64
import re
75
import sys
86
import dbus
97
import dbus.mainloop.glib
10-
try:
11-
from gi.repository import GObject
12-
except ImportError:
13-
import gobject as GObject
8+
from gi.repository import GLib
9+
1410
import bluezutils
1511

1612
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1713
bus = dbus.SystemBus()
18-
mainloop = GObject.MainLoop()
14+
mainloop = GLib.MainLoop()
1915

2016
option_list = [
2117
make_option("-i", "--device", action="store",
@@ -48,7 +44,7 @@ if (args[0] == "list"):
4844
"org.freedesktop.DBus.ObjectManager")
4945
objects = om.GetManagedObjects()
5046

51-
for path, interfaces in objects.iteritems():
47+
for path, interfaces in objects.items():
5248
if "org.bluez.Device1" not in interfaces:
5349
continue
5450
properties = interfaces["org.bluez.Device1"]

scriptmodules/supplementary/bluetooth/bluezutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def find_adapter(pattern=None):
1515

1616
def find_adapter_in_objects(objects, pattern=None):
1717
bus = dbus.SystemBus()
18-
for path, ifaces in objects.iteritems():
18+
for path, ifaces in objects.items():
1919
adapter = ifaces.get(ADAPTER_INTERFACE)
2020
if adapter is None:
2121
continue
@@ -35,7 +35,7 @@ def find_device_in_objects(objects, device_address, adapter_pattern=None):
3535
if adapter_pattern:
3636
adapter = find_adapter_in_objects(objects, adapter_pattern)
3737
path_prefix = adapter.object_path
38-
for path, ifaces in objects.iteritems():
38+
for path, ifaces in objects.items():
3939
device = ifaces.get(DEVICE_INTERFACE)
4040
if device is None:
4141
continue

0 commit comments

Comments
 (0)