From 209c95ea443041146229336379e66e659d72edae Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Tue, 30 Oct 2012 12:59:37 +0100 Subject: Migrate all scripts to python3. --- .bzrignore | 1 + examples/exportactiongroup.py | 8 ++++---- examples/exportmenu.py | 2 +- tests/client/script_actiongrouptest.py | 2 +- tests/client/script_menuchangestest.py | 2 +- tests/client/script_modeltest.py | 6 +++--- tests/client/script_qmltest.py | 2 +- tests/client/script_servicetest.py | 2 +- tests/script/menuscript.py | 2 +- 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.bzrignore b/.bzrignore index 8dfdfff..2d8eae1 100644 --- a/.bzrignore +++ b/.bzrignore @@ -22,6 +22,7 @@ tests/client/modeltest tests/client/qmlfiles.h tests/client/qmltest tests/client/servicetest +tests/script/__pycache__/ doc/html/ doc/qmenumodel.qdocconf diff --git a/examples/exportactiongroup.py b/examples/exportactiongroup.py index f69416e..0f2d675 100755 --- a/examples/exportactiongroup.py +++ b/examples/exportactiongroup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- encoding: utf-8 -*- """ @@ -20,10 +20,10 @@ BUS_OBJECT_PATH = '/com/canonical/testactiongroup' def action_activated(action, data): name = action.get_name() if action.get_state_type() is None: - print 'stateless action activated: %s' % name + print('stateless action activated: %s' % name) else: - print 'stateful action activated: %s (current state: %s)' % - (name, action.get_state()) + print('stateful action activated: %s (current state: %s)' % + (name, action.get_state())) if __name__ == '__main__': diff --git a/examples/exportmenu.py b/examples/exportmenu.py index 831f995..70cc6f3 100755 --- a/examples/exportmenu.py +++ b/examples/exportmenu.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- encoding: utf-8 -*- """ diff --git a/tests/client/script_actiongrouptest.py b/tests/client/script_actiongrouptest.py index 43409da..2af4841 100755 --- a/tests/client/script_actiongrouptest.py +++ b/tests/client/script_actiongrouptest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python3 import time from gi.repository import GLib diff --git a/tests/client/script_menuchangestest.py b/tests/client/script_menuchangestest.py index 67f2ee0..47e37bb 100755 --- a/tests/client/script_menuchangestest.py +++ b/tests/client/script_menuchangestest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python3 import time from menuscript import Script, ActionList, MENU_OBJECT_PATH diff --git a/tests/client/script_modeltest.py b/tests/client/script_modeltest.py index 95df442..84a0d9c 100755 --- a/tests/client/script_modeltest.py +++ b/tests/client/script_modeltest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python3 import time from gi.repository import GLib @@ -8,7 +8,7 @@ al = ActionList(MENU_OBJECT_PATH) # create map pmap = {'int64' : GLib.Variant('x', -42), - 'string': GLib.Variant('s', u'42'), + 'string': GLib.Variant('s', '42'), 'double': GLib.Variant('d', 42.42)} al.appendItem("Menu0", "Menu0Act", None, None, {'x-boolean' : GLib.Variant('b', True), @@ -20,7 +20,7 @@ al.appendItem("Menu0", "Menu0Act", None, None, {'x-boolean' : GLib.Variant('b', 'x-int64' : GLib.Variant('x', -42), 'x-uint64' : GLib.Variant('t', 42), 'x-double' : GLib.Variant('d', 42.42), - 'x-string' : GLib.Variant('s', u'42'), + 'x-string' : GLib.Variant('s', '42'), 'x-map' : GLib.Variant('a{sv}', pmap), }) al.appendItem("Menu1", "Menu1Act") diff --git a/tests/client/script_qmltest.py b/tests/client/script_qmltest.py index 385256c..c93e221 100755 --- a/tests/client/script_qmltest.py +++ b/tests/client/script_qmltest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python3 import time from menuscript import Script, ActionList, MENU_OBJECT_PATH diff --git a/tests/client/script_servicetest.py b/tests/client/script_servicetest.py index 385256c..c93e221 100755 --- a/tests/client/script_servicetest.py +++ b/tests/client/script_servicetest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 +#!/usr/bin/env python3 import time from menuscript import Script, ActionList, MENU_OBJECT_PATH diff --git a/tests/script/menuscript.py b/tests/script/menuscript.py index ba67560..60cb33b 100644 --- a/tests/script/menuscript.py +++ b/tests/script/menuscript.py @@ -114,7 +114,7 @@ class Action(object): # Remove action self._list._rootAction.remove(self._kargs['actionName']) else: - print "Remove menu item" + print("Remove menu item") def run(self): if self._action == 'append': -- cgit v1.2.3