[meld] Further future compat adjusted from 2to3
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Further future compat adjusted from 2to3
- Date: Fri, 30 Nov 2012 19:29:57 +0000 (UTC)
commit 7c7ea81040368a824becd1a2b4f2f29b61e4f16c
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Oct 27 12:40:09 2012 +1000
Further future compat adjusted from 2to3
meld/meldbuffer.py | 2 +-
meld/meldwindow.py | 3 ++-
meld/ui/gnomeglade.py | 2 +-
meld/util/compat.py | 1 +
meld/util/prefs.py | 9 ++++++---
5 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/meld/meldbuffer.py b/meld/meldbuffer.py
index e23c817..b7e9f3c 100644
--- a/meld/meldbuffer.py
+++ b/meld/meldbuffer.py
@@ -133,7 +133,7 @@ class BufferLines(object):
lines.append("")
ends.append("")
- hi = self.buf.get_line_count() if hi == sys.maxint else hi
+ hi = self.buf.get_line_count() if hi == sys.maxsize else hi
if hi - lo != len(lines):
# These codepoints are considered line breaks by Python, but not
# by GtkTextStore.
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index c4d0ea2..1bd6d38 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -34,6 +34,7 @@ from . import vcview
from .ui import gnomeglade
from .ui import notebooklabel
+from .util.compat import string_types
from .util.sourceviewer import srcviewer
from .meldapp import app
@@ -256,7 +257,7 @@ class MeldWindow(gnomeglade.Component):
def on_idle(self):
ret = self.scheduler.iteration()
- if ret and isinstance(ret, basestring):
+ if ret and isinstance(ret, string_types):
self.statusbar.set_task_status(ret)
pending = self.scheduler.tasks_pending()
diff --git a/meld/ui/gnomeglade.py b/meld/ui/gnomeglade.py
index d7b3f2b..181cecc 100644
--- a/meld/ui/gnomeglade.py
+++ b/meld/ui/gnomeglade.py
@@ -93,7 +93,7 @@ def connect_signal_handlers(obj):
if match:
when, widgetname, signal = match.groups()
method = getattr(obj, attr)
- assert callable(method)
+ assert hasattr(method, '__call__')
try:
widget = getattr(obj, widgetname)
except AttributeError:
diff --git a/meld/util/compat.py b/meld/util/compat.py
index bd580f0..5bff563 100644
--- a/meld/util/compat.py
+++ b/meld/util/compat.py
@@ -3,3 +3,4 @@ import sys
# Python 2/3 compatibility, named as per six
text_type = str if sys.version_info[0] == 3 else unicode
+string_types = str if sys.version_info[0] == 3 else basestring
diff --git a/meld/util/prefs.py b/meld/util/prefs.py
index 46a8bce..9867e47 100644
--- a/meld/util/prefs.py
+++ b/meld/util/prefs.py
@@ -177,7 +177,7 @@ class ConfigParserPreferences(object):
rootkey : unused (retained for compatibility with existing gconf API)
initial : a dictionary of string to Value objects.
"""
- self.__dict__["_parser"] = ConfigParser.SafeConfigParser()
+ self.__dict__["_parser"] = configparser.SafeConfigParser()
self.__dict__["_listeners"] = []
self.__dict__["_prefs"] = initial
self.__dict__["_type_mappings"] = {
@@ -269,10 +269,13 @@ class ConfigParserPreferences(object):
return "\n".join(prefs_entries)
-# Prefer gconf, falling back to ConfigParser
+# Prefer gconf, falling back to configparser
try:
import gconf
Preferences = GConfPreferences
except ImportError:
- import ConfigParser
+ try:
+ import configparser
+ except ImportError:
+ import ConfigParser as configparser
Preferences = ConfigParserPreferences
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]