[accerciser] Make Macaroon work in Python 3
- From: Javier Hernández Antúnez <jhernandez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [accerciser] Make Macaroon work in Python 3
- Date: Thu, 6 Mar 2014 14:45:48 +0000 (UTC)
commit bf0865bcdf383a5b14d6d4df78debe1851a0b69b
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Nov 27 10:43:35 2013 -0500
Make Macaroon work in Python 3
macaroon/bin/macaroon.in | 2 +-
macaroon/configure.in | 12 +++++++++++-
macaroon/macaroon/playback/__init__.py | 8 ++++----
macaroon/macaroon/playback/keypress_actions.py | 6 +++---
macaroon/macaroon/playback/keypress_mimic.py | 2 +-
macaroon/macaroon/playback/sequence.py | 4 ++--
macaroon/macaroon/playback/sequence_step.py | 2 +-
macaroon/macaroon/playback/wait_actions.py | 4 ++--
macaroon/macaroon/record/about.py | 1 +
macaroon/macaroon/record/main.py | 10 +++++-----
macaroon/macaroon/record/script_factory.py | 7 +++----
macaroon/pyreqs.py | 6 +++---
12 files changed, 37 insertions(+), 27 deletions(-)
---
diff --git a/macaroon/bin/macaroon.in b/macaroon/bin/macaroon.in
index 0a5050f..b04900b 100644
--- a/macaroon/bin/macaroon.in
+++ b/macaroon/bin/macaroon.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#! PYTHON@
# Macaroon - a desktop macro tool
# Copyright (C) 2007 Eitan Isaacson <eitan ascender com>
# All rights reserved.
diff --git a/macaroon/configure.in b/macaroon/configure.in
index 01395bb..1bba6b1 100644
--- a/macaroon/configure.in
+++ b/macaroon/configure.in
@@ -4,7 +4,17 @@ AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE([enable])
dnl == check for python ==
-AM_PATH_PYTHON(2.4)
+AM_PATH_PYTHON(3.2)
+
+dnl == requeriments ==
+GTK_REQUIRED=3.1.13
+PYGOBJECT_REQUIRED=2.90.3
+ATSPI_REQUIRED=2.5.2
+
+dnl == check for requeriments ==
+PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= GTK_REQUIRED])
+PKG_CHECK_MODULES([PYGOBJECT], [pygobject-3.0 >= PYGOBJECT_REQUIRED])
+PKG_CHECK_MODULES([ATSPI2], [atspi-2 >= ATSPI_REQUIRED])
dnl == i18n ==
GETTEXT_PACKAGE=macaroon
diff --git a/macaroon/macaroon/playback/__init__.py b/macaroon/macaroon/playback/__init__.py
index 5e7d0fa..2852737 100644
--- a/macaroon/macaroon/playback/__init__.py
+++ b/macaroon/macaroon/playback/__init__.py
@@ -1,4 +1,4 @@
-from sequence import *
-from wait_actions import *
-from keypress_actions import *
-from sequence_step import *
+from .sequence import *
+from .wait_actions import *
+from .keypress_actions import *
+from .sequence_step import *
diff --git a/macaroon/macaroon/playback/keypress_actions.py b/macaroon/macaroon/playback/keypress_actions.py
index 420d7cc..39a38f7 100644
--- a/macaroon/macaroon/playback/keypress_actions.py
+++ b/macaroon/macaroon/playback/keypress_actions.py
@@ -20,8 +20,8 @@ from gi.repository import Gdk
from gi.repository import GLib
import pyatspi
-from sequence_step import AtomicAction
-import utils
+from .sequence_step import AtomicAction
+from . import utils
_ = lambda x: x
@@ -168,7 +168,7 @@ class KeyComboAction(AtomicAction):
@type modifiers: integer
'''
interval = 0
- mod_hw_codes = map(mod_key_code_mappings.get, modifiers.value_names)
+ mod_hw_codes = list(map(mod_key_code_mappings.get, modifiers.value_names))
for mod_hw_code in mod_hw_codes:
GLib.timeout_add(interval, self._keyPress, mod_hw_code)
interval += keystroke_interval
diff --git a/macaroon/macaroon/playback/keypress_mimic.py b/macaroon/macaroon/playback/keypress_mimic.py
index bb9c543..5485fe6 100644
--- a/macaroon/macaroon/playback/keypress_mimic.py
+++ b/macaroon/macaroon/playback/keypress_mimic.py
@@ -11,7 +11,7 @@
# Headers in this file shall remain intact.
-from __init__ import *
+from .__init__ import *
import sys
diff --git a/macaroon/macaroon/playback/sequence.py b/macaroon/macaroon/playback/sequence.py
index 282f234..003df1d 100644
--- a/macaroon/macaroon/playback/sequence.py
+++ b/macaroon/macaroon/playback/sequence.py
@@ -19,7 +19,7 @@ from gi.repository import GObject
from gi.repository import GLib
import pyatspi
import sys
-from wait_actions import WaitAction
+from .wait_actions import WaitAction
from os import environ
_ = lambda x: x
@@ -95,7 +95,7 @@ class MacroSequence(GObject.GObject):
return
action = self.steps[self._current_step]
if self._verbose:
- print _('SEQUENCE: %s') % action
+ print(_('SEQUENCE: %s') % action)
try:
next_action = self.steps[self._current_step + 1]
diff --git a/macaroon/macaroon/playback/sequence_step.py b/macaroon/macaroon/playback/sequence_step.py
index cef4d12..304c1e0 100644
--- a/macaroon/macaroon/playback/sequence_step.py
+++ b/macaroon/macaroon/playback/sequence_step.py
@@ -111,7 +111,7 @@ class DebugAction(AtomicAction):
'''
Print the debug message.
'''
- print self._debug_msg
+ print(self._debug_msg)
def __str__(self):
'''
diff --git a/macaroon/macaroon/playback/wait_actions.py b/macaroon/macaroon/playback/wait_actions.py
index 818e09f..4830ab2 100644
--- a/macaroon/macaroon/playback/wait_actions.py
+++ b/macaroon/macaroon/playback/wait_actions.py
@@ -20,8 +20,8 @@ import pyatspi
import re
-from sequence_step import SequenceStep
-import utils
+from .sequence_step import SequenceStep
+from . import utils
import sys
_ = lambda x: x
diff --git a/macaroon/macaroon/record/about.py b/macaroon/macaroon/record/about.py
index a5a3ece..643ee63 100644
--- a/macaroon/macaroon/record/about.py
+++ b/macaroon/macaroon/record/about.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
# Macaroon - a desktop macro tool
# Copyright (C) 2007 Eitan Isaacson <eitan ascender com>
# All rights reserved.
diff --git a/macaroon/macaroon/record/main.py b/macaroon/macaroon/record/main.py
index 4e74fde..33a9d54 100644
--- a/macaroon/macaroon/record/main.py
+++ b/macaroon/macaroon/record/main.py
@@ -17,8 +17,8 @@ from gi.repository import GObject
from gi.repository import Pango
from gi.repository import GtkSource
-import script_factory
-from Queue import Queue
+from . import script_factory
+from queue import Queue
from macaroon.playback import MacroSequence
APP_ID = None
@@ -26,7 +26,7 @@ APP_ID = None
MacroSequence.startReally = MacroSequence.start
MacroSequence.start = lambda x: None
-from about import MacaroonAboutDialog
+from .about import MacaroonAboutDialog
import pyatspi
@@ -308,7 +308,7 @@ class ScriptBuffer(GtkSource.Buffer):
'document:load-complete')
pyatspi.Registry.registerKeystrokeListener(
self._onKeystroke,
- mask = range(256),
+ mask = list(range(256)),
kind=(pyatspi.KEY_PRESSED_EVENT, pyatspi.KEY_RELEASED_EVENT))
self.set_property('recording', True)
@@ -321,7 +321,7 @@ class ScriptBuffer(GtkSource.Buffer):
'document:load-complete')
pyatspi.Registry.deregisterKeystrokeListener(
self._onKeystroke,
- mask = range(256),
+ mask = list(range(256)),
kind=(pyatspi.KEY_PRESSED_EVENT, pyatspi.KEY_RELEASED_EVENT))
self.script_factory.terminateScript()
while self.script_factory.commands_queue.qsize():
diff --git a/macaroon/macaroon/record/script_factory.py b/macaroon/macaroon/record/script_factory.py
index 2877047..ef5ed3f 100644
--- a/macaroon/macaroon/record/script_factory.py
+++ b/macaroon/macaroon/record/script_factory.py
@@ -15,8 +15,7 @@ from gi.repository import Gtk
from gi.repository import Gdk
import pyatspi
-
-from Queue import Queue
+from queue import Queue
from time import time
class _CommandsQueue(Queue):
@@ -46,7 +45,7 @@ class ScriptFactory(object):
@ivar frame_name: The last focused window frame name.
@type frame_name: string.
'''
- intepreter_line = '#!/usr/bin/python'
+ intepreter_line = '#!/usr/bin/python3.2'
import_line = ''
MODIFIERS = [Gdk.KEY_Control_L, Gdk.KEY_Control_R,
Gdk.KEY_Alt_L, Gdk.KEY_Alt_R,
@@ -185,7 +184,7 @@ class Level2SequenceFactory(SequenceFactory):
self.frame_name = event.source.name
def docLoadCommand(self):
- print 'factory thing'
+ print('factory thing')
self.commands_queue.put_nowait(
'sequence.append(WaitForDocLoad())\n')
diff --git a/macaroon/pyreqs.py b/macaroon/pyreqs.py
index 234b41d..328f8fa 100644
--- a/macaroon/pyreqs.py
+++ b/macaroon/pyreqs.py
@@ -28,12 +28,12 @@ modules = ['pygtk', 'gtk', 'Gtk.gdk', 'wnck']
for name in modules:
try:
m = __import__(name)
- print name,
- except ImportError, e:
+ print(name)
+ except ImportError as e:
if name == 'wnck' and e.args[0].find('gtk') > -1:
# just no display, continue
continue
- print name, '*MISSING*'
+ print(name, '*MISSING*')
sys.exit(1)
except RuntimeError:
# ignore other errors which might be from lack of a display
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]