void-packages/srcpkgs/telepathy-salut/patches/python3.patch

98 lines
2.9 KiB
Diff

--- a/tools/libglibcodegen.py
+++ b/tools/libglibcodegen.py
@@ -55,9 +55,8 @@
return camelcase_to_lower(s).upper()
-def cmp_by_name(node1, node2):
- return cmp(node1.getAttributeNode("name").nodeValue,
- node2.getAttributeNode("name").nodeValue)
+def key_by_name(node):
+ return node.getAttributeNode("name").nodeValue
def dbus_gutils_wincaps_to_uscore(s):
@@ -191,6 +191,9 @@
self.remaining = string
def next(self):
+ return self.__next__()
+
+ def __next__(self):
if self.remaining == '':
raise StopIteration
@@ -297,7 +297,7 @@
return ("GHashTable *", "DBUS_TYPE_G_STRING_STRING_HASHTABLE", "BOXED", False)
elif s[:2] == 'a{': #some arbitrary hash tables
if s[2] not in ('y', 'b', 'n', 'q', 'i', 'u', 's', 'o', 'g'):
- raise Exception, "can't index a hashtable off non-basic type " + s
+ raise Exception("can't index a hashtable off non-basic type " + s)
first = type_to_gtype(s[2])
second = type_to_gtype(s[3:-1])
return ("GHashTable *", "(dbus_g_type_get_map (\"GHashTable\", " + first[1] + ", " + second[1] + "))", "BOXED", False)
@@ -312,7 +312,7 @@
return ("GValueArray *", gtype, "BOXED", True)
# we just don't know ..
- raise Exception, "don't know the GType for " + s
+ raise Exception("don't know the GType for " + s)
def xml_escape(s):
--- a/tools/glib-signals-marshal-gen.py
+++ b/tools/glib-signals-marshal-gen.py
@@ -41,12 +41,12 @@
for signal in signals:
self.do_signal(signal)
- all = self.marshallers.keys()
+ all = list(self.marshallers.keys())
all.sort()
for marshaller in all:
rhs = self.marshallers[marshaller]
if not marshaller.startswith('g_cclosure'):
- print 'VOID:' + ','.join(rhs)
+ print('VOID:' + ','.join(rhs))
if __name__ == '__main__':
argv = sys.argv[1:]
--- a/tools/glib-ginterface-gen.py
+++ b/tools/glib-ginterface-gen.py
@@ -26,7 +26,7 @@
import os.path
import xml.dom.minidom
-from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
+from libglibcodegen import Signature, type_to_gtype, key_by_name, \
camelcase_to_lower, NS_TP, dbus_gutils_wincaps_to_uscore, \
signal_to_marshal_name, method_to_glue_marshal_name
@@ -620,7 +620,7 @@
self.b('')
nodes = self.dom.getElementsByTagName('node')
- nodes.sort(cmp_by_name)
+ nodes.sort(key=key_by_name)
for node in nodes:
self.do_node(node)
@@ -639,7 +639,7 @@
def cmdline_error():
- print """\
+ print("""\
usage:
gen-ginterface [OPTIONS] xmlfile Prefix_
options:
@@ -659,7 +659,7 @@
void symbol (DBusGMethodInvocation *context)
and return some sort of "not implemented" error via
dbus_g_method_return_error (context, ...)
-"""
+""")
sys.exit(1)