- Build using python3: + Add 1.patch: Fix build when using python3. + Drop python-xml BuildRequires. OBS-URL: https://build.opensuse.org/request/show/853074 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/telepathy-rakia?expand=0&rev=13
123 lines
4.4 KiB
Diff
123 lines
4.4 KiB
Diff
From b34225eeef0da38f41708c2fbf40ab196163c708 Mon Sep 17 00:00:00 2001
|
|
From: Phillip Schichtel <phillip@schich.tel>
|
|
Date: Sat, 30 Nov 2019 19:33:23 +0100
|
|
Subject: [PATCH] Migrate tools to python3 to be able to build on modern
|
|
systems
|
|
|
|
---
|
|
tools/glib-client-marshaller-gen.py | 19 +++++++++----------
|
|
tools/glib-ginterface-gen.py | 7 +++----
|
|
tools/glib-signals-marshal-gen.py | 5 ++---
|
|
tools/libglibcodegen.py | 4 ++--
|
|
4 files changed, 16 insertions(+), 19 deletions(-)
|
|
|
|
diff --git a/tools/glib-client-marshaller-gen.py b/tools/glib-client-marshaller-gen.py
|
|
index 5444725..675c545 100644
|
|
--- a/tools/glib-client-marshaller-gen.py
|
|
+++ b/tools/glib-client-marshaller-gen.py
|
|
@@ -31,22 +31,21 @@ def __call__(self):
|
|
for signal in signals:
|
|
self.do_signal(signal)
|
|
|
|
- print 'void'
|
|
- print '%s_register_dbus_glib_marshallers (void)' % self.prefix
|
|
- print '{'
|
|
+ print('void')
|
|
+ print('%s_register_dbus_glib_marshallers (void)' % self.prefix)
|
|
+ print('{')
|
|
|
|
- all = self.marshallers.keys()
|
|
- all.sort()
|
|
+ all = sorted(self.marshallers.keys())
|
|
for marshaller in all:
|
|
rhs = self.marshallers[marshaller]
|
|
|
|
- print ' dbus_g_object_register_marshaller (%s,' % marshaller
|
|
- print ' G_TYPE_NONE, /* return */'
|
|
+ print(' dbus_g_object_register_marshaller (%s,' % marshaller)
|
|
+ print(' G_TYPE_NONE, /* return */')
|
|
for type in rhs:
|
|
- print ' G_TYPE_%s,' % type.replace('VOID', 'NONE')
|
|
- print ' G_TYPE_INVALID);'
|
|
+ print(' G_TYPE_%s,' % type.replace('VOID', 'NONE'))
|
|
+ print(' G_TYPE_INVALID);')
|
|
|
|
- print '}'
|
|
+ print('}')
|
|
|
|
|
|
def types_to_gtypes(types):
|
|
diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py
|
|
index a8180b7..414a1f9 100644
|
|
--- a/tools/glib-ginterface-gen.py
|
|
+++ b/tools/glib-ginterface-gen.py
|
|
@@ -619,8 +619,7 @@ def __call__(self):
|
|
self.b('#include %s' % header)
|
|
self.b('')
|
|
|
|
- nodes = self.dom.getElementsByTagName('node')
|
|
- nodes.sort(cmp_by_name)
|
|
+ nodes = sorted(self.dom.getElementsByTagName('node'))
|
|
|
|
for node in nodes:
|
|
self.do_node(node)
|
|
@@ -639,7 +638,7 @@ def __call__(self):
|
|
|
|
|
|
def cmdline_error():
|
|
- print """\
|
|
+ print("""\
|
|
usage:
|
|
gen-ginterface [OPTIONS] xmlfile Prefix_
|
|
options:
|
|
@@ -659,7 +658,7 @@ def cmdline_error():
|
|
void symbol (DBusGMethodInvocation *context)
|
|
and return some sort of "not implemented" error via
|
|
dbus_g_method_return_error (context, ...)
|
|
-"""
|
|
+""")
|
|
sys.exit(1)
|
|
|
|
|
|
diff --git a/tools/glib-signals-marshal-gen.py b/tools/glib-signals-marshal-gen.py
|
|
index 0d02c13..c76ff5e 100644
|
|
--- a/tools/glib-signals-marshal-gen.py
|
|
+++ b/tools/glib-signals-marshal-gen.py
|
|
@@ -41,12 +41,11 @@ def __call__(self):
|
|
for signal in signals:
|
|
self.do_signal(signal)
|
|
|
|
- all = self.marshallers.keys()
|
|
- all.sort()
|
|
+ all = sorted(self.marshallers.keys())
|
|
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:]
|
|
diff --git a/tools/libglibcodegen.py b/tools/libglibcodegen.py
|
|
index 090e8de..80042ba 100644
|
|
--- a/tools/libglibcodegen.py
|
|
+++ b/tools/libglibcodegen.py
|
|
@@ -297,7 +297,7 @@ def type_to_gtype(s):
|
|
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 @@ def type_to_gtype(s):
|
|
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):
|