Source

pyside_aur / python-pyside-tools / 2to3.patch

diff --git a/pysideuic/Compiler/proxy_type.py b/pysideuic/Compiler/proxy_type.py
index c80843a..0708ecc 100644
--- a/pysideuic/Compiler/proxy_type.py
+++ b/pysideuic/Compiler/proxy_type.py
@@ -26,7 +26,7 @@ from pysideuic.Compiler.misc import Literal, moduleMember
 class ProxyType(type):
     def __init__(*args):
         type.__init__(*args)
-        for cls in args[0].__dict__.values():
+        for cls in list(args[0].__dict__.values()):
             if type(cls) is ProxyType:
                 cls.module = args[0].__name__
 
diff --git a/pysideuic/Compiler/qobjectcreator.py b/pysideuic/Compiler/qobjectcreator.py
index d46acc0..491a8e0 100644
--- a/pysideuic/Compiler/qobjectcreator.py
+++ b/pysideuic/Compiler/qobjectcreator.py
@@ -116,7 +116,7 @@ class _CustomWidgetLoader(object):
             _, module = self._widgets[widget]
             imports.setdefault(module, []).append(widget)
 
-        for module, classes in imports.items():
+        for module, classes in list(imports.items()):
             write_code("from %s import %s" % (module, ", ".join(classes)))
 
 
diff --git a/pysideuic/icon_cache.py b/pysideuic/icon_cache.py
index 523d207..d8c699c 100644
--- a/pysideuic/icon_cache.py
+++ b/pysideuic/icon_cache.py
@@ -113,7 +113,7 @@ class _IconSet(object):
         if self._use_fallback:
             icon.addFile(self._fallback)
         else:
-            for role, pixmap in self._roles.items():
+            for role, pixmap in list(self._roles.items()):
                 if role.endswith("off"):
                     mode = role[:-3]
                     state = qtgui_module.QIcon.Off
diff --git a/pysideuic/port_v2/as_string.py b/pysideuic/port_v2/as_string.py
index 23272b2..cb7780c 100644
--- a/pysideuic/port_v2/as_string.py
+++ b/pysideuic/port_v2/as_string.py
@@ -23,7 +23,7 @@ import re
 
 
 def as_string(obj, encode=True):
-    if isinstance(obj, basestring):
+    if isinstance(obj, str):
         s = '"' + _escape(obj.encode('UTF-8')) + '"'
         return s
 
diff --git a/pysideuic/port_v2/invoke.py b/pysideuic/port_v2/invoke.py
index 7652904..5128092 100644
--- a/pysideuic/port_v2/invoke.py
+++ b/pysideuic/port_v2/invoke.py
@@ -33,16 +33,16 @@ def invoke(driver):
     try:
         exit_status = driver.invoke()
 
-    except IOError, e:
+    except IOError as e:
         driver.on_IOError(e)
 
-    except SyntaxError, e:
+    except SyntaxError as e:
         driver.on_SyntaxError(e)
 
-    except NoSuchWidgetError, e:
+    except NoSuchWidgetError as e:
         driver.on_NoSuchWidgetError(e)
 
-    except Exception, e:
+    except Exception as e:
         driver.on_Exception(e)
 
     return exit_status
diff --git a/pysideuic/port_v2/load_plugin.py b/pysideuic/port_v2/load_plugin.py
index 5212d6f..b85ec76 100644
--- a/pysideuic/port_v2/load_plugin.py
+++ b/pysideuic/port_v2/load_plugin.py
@@ -33,7 +33,7 @@ def load_plugin(plugin, plugin_globals, plugin_locals):
         exec(plugin.read(), plugin_globals, plugin_locals)
     except ImportError:
         return False
-    except Exception, e:
+    except Exception as e:
         raise WidgetPluginError("%s: %s" % (e.__class__, str(e)))
 
     return True
diff --git a/pysideuic/port_v2/proxy_base.py b/pysideuic/port_v2/proxy_base.py
index 732b2e2..23f4dba 100644
--- a/pysideuic/port_v2/proxy_base.py
+++ b/pysideuic/port_v2/proxy_base.py
@@ -23,5 +23,5 @@
 from pysideuic.Compiler.proxy_type import ProxyType
 
 
-class ProxyBase(object):
-    __metaclass__ = ProxyType
+class ProxyBase(object, metaclass=ProxyType):
+    pass
diff --git a/pysideuic/port_v2/string_io.py b/pysideuic/port_v2/string_io.py
index 4657b52..adb9f12 100644
--- a/pysideuic/port_v2/string_io.py
+++ b/pysideuic/port_v2/string_io.py
@@ -22,6 +22,6 @@
 
 # Import the StringIO object.
 try:
-    from cStringIO import StringIO
+    from io import StringIO
 except ImportError:
-    from StringIO import StringIO
+    from io import StringIO
diff --git a/pysideuic/uiparser.py b/pysideuic/uiparser.py
index c49bfe1..4c7cbe1 100644
--- a/pysideuic/uiparser.py
+++ b/pysideuic/uiparser.py
@@ -41,7 +41,7 @@ DEBUG = logger.debug
 
 if sys.version_info < (2,4,0):
     def reversed(seq):
-        for i in xrange(len(seq)-1, -1, -1):
+        for i in range(len(seq)-1, -1, -1):
             yield seq[i]
 
 QtCore = None