python3: convert dbus-unit-test.py
The latest Ubuntu release (focal) no longer installs a default "python"
in the filesystem. The only issue found converting this script over to
python3 was that splitlines() now returns a bytes string. os.environ did
not like that so explicitly convert the byte string to a normal string.
Change-Id: I05f4c8a8090074c71c9afd156f5963b6f6668884
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/scripts/dbus-unit-test.py b/scripts/dbus-unit-test.py
index 0bb66a7..a931761 100755
--- a/scripts/dbus-unit-test.py
+++ b/scripts/dbus-unit-test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
This script launches a dbus session, sets the DBUS_SESSION_BUS_ADDRESS
@@ -46,7 +46,7 @@
command = ['dbus-daemon', '--config-file=%s' % dbus_local_conf, \
'--print-address']
out = check_output(command).splitlines()
- os.environ['DBUS_SESSION_BUS_ADDRESS'] = out[0]
+ os.environ['DBUS_SESSION_BUS_ADDRESS'] = out[0].decode("utf-8")
os.environ['DBUS_STARTER_BUS_TYPE'] = 'session'
def dbus_cleanup(dbus_dir):