telepathy-gabble: patch for python3
This commit is contained in:
parent
49e6aa8c83
commit
a3e3bce235
|
@ -0,0 +1,871 @@
|
|||
From 1aeffdb74a1d7ce8b93587ded4f5a434cd1dfc06 Mon Sep 17 00:00:00 2001
|
||||
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
|
||||
Date: Fri, 1 Nov 2013 14:12:06 +0000
|
||||
Subject: [PATCH] Update Python tools from telepathy-glib (avoid deprecations,
|
||||
etc.)
|
||||
|
||||
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=26609
|
||||
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
|
||||
---
|
||||
tools/c-constants-gen.py | 12 ++--
|
||||
tools/glib-client-gen.py | 94 +++++++----------------------
|
||||
tools/glib-client-marshaller-gen.py | 20 +++---
|
||||
tools/glib-errors-check-gen.py | 62 +++++++++----------
|
||||
tools/glib-errors-str-gen.py | 14 ++---
|
||||
tools/glib-ginterface-gen.py | 22 +++----
|
||||
tools/glib-gtypes-generator.py | 14 ++---
|
||||
tools/glib-interfaces-gen.py | 14 ++---
|
||||
tools/gobject-foo.py | 2 +-
|
||||
tools/libglibcodegen.py | 27 ++++++++-
|
||||
tools/libtpcodegen.py | 22 ++++++-
|
||||
tools/make-version-script.py | 32 +++++-----
|
||||
tools/xincludator.py | 13 +++-
|
||||
13 files changed, 167 insertions(+), 181 deletions(-)
|
||||
|
||||
diff --git a/tools/c-constants-gen.py b/tools/c-constants-gen.py
|
||||
index c7a93d371..a08afee06 100644
|
||||
--- a/tools/c-constants-gen.py
|
||||
+++ b/tools/c-constants-gen.py
|
||||
@@ -3,7 +3,7 @@
|
||||
from sys import argv, stdout, stderr
|
||||
import xml.dom.minidom
|
||||
|
||||
-from libtpcodegen import file_set_contents
|
||||
+from libtpcodegen import file_set_contents, u
|
||||
from libglibcodegen import NS_TP, get_docstring, \
|
||||
get_descendant_text, get_by_path
|
||||
|
||||
@@ -12,7 +12,7 @@ def __init__(self, prefix, dom, output_base):
|
||||
self.prefix = prefix + '_'
|
||||
self.spec = get_by_path(dom, "spec")[0]
|
||||
|
||||
- self.output_base = output_base
|
||||
+ self.output_base = output_base
|
||||
self.__header = []
|
||||
self.__docs = []
|
||||
|
||||
@@ -21,14 +21,14 @@ def __call__(self):
|
||||
self.do_body()
|
||||
self.do_footer()
|
||||
|
||||
- file_set_contents(self.output_base + '.h', ''.join(self.__header))
|
||||
- file_set_contents(self.output_base + '-gtk-doc.h', ''.join(self.__docs))
|
||||
+ file_set_contents(self.output_base + '.h', u('').join(self.__header).encode('utf-8'))
|
||||
+ file_set_contents(self.output_base + '-gtk-doc.h', u('').join(self.__docs).encode('utf-8'))
|
||||
|
||||
def write(self, code):
|
||||
- self.__header.append(code.encode('utf-8'))
|
||||
+ self.__header.append(code)
|
||||
|
||||
def d(self, code):
|
||||
- self.__docs.append(code.encode('utf-8'))
|
||||
+ self.__docs.append(code)
|
||||
|
||||
# Header
|
||||
def do_header(self):
|
||||
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
|
||||
index f8465a62b..a0fecf083 100644
|
||||
--- a/tools/glib-client-gen.py
|
||||
+++ b/tools/glib-client-gen.py
|
||||
@@ -27,9 +27,9 @@
|
||||
import xml.dom.minidom
|
||||
from getopt import gnu_getopt
|
||||
|
||||
-from libtpcodegen import file_set_contents
|
||||
-from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
|
||||
- get_docstring, xml_escape, get_deprecated
|
||||
+from libtpcodegen import file_set_contents, key_by_name, u
|
||||
+from libglibcodegen import (Signature, type_to_gtype,
|
||||
+ get_docstring, xml_escape, get_deprecated, copy_into_gvalue)
|
||||
|
||||
|
||||
NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
|
||||
@@ -74,18 +74,12 @@ def __init__(self, dom, prefix, basename, opts):
|
||||
self.guard = opts.get('--guard', None)
|
||||
|
||||
def h(self, s):
|
||||
- if isinstance(s, unicode):
|
||||
- s = s.encode('utf-8')
|
||||
self.__header.append(s)
|
||||
|
||||
def b(self, s):
|
||||
- if isinstance(s, unicode):
|
||||
- s = s.encode('utf-8')
|
||||
self.__body.append(s)
|
||||
|
||||
def d(self, s):
|
||||
- if isinstance(s, unicode):
|
||||
- s = s.encode('utf-8')
|
||||
self.__docs.append(s)
|
||||
|
||||
def get_iface_quark(self):
|
||||
@@ -192,6 +186,7 @@ def do_signal(self, iface, signal):
|
||||
|
||||
self.b(' TpProxySignalConnection *sc)')
|
||||
self.b('{')
|
||||
+ self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
|
||||
self.b(' GValueArray *args = g_value_array_new (%d);' % len(args))
|
||||
self.b(' GValue blank = { 0 };')
|
||||
self.b(' guint i;')
|
||||
@@ -200,6 +195,7 @@ def do_signal(self, iface, signal):
|
||||
self.b('')
|
||||
self.b(' for (i = 0; i < %d; i++)' % len(args))
|
||||
self.b(' g_value_array_append (args, &blank);')
|
||||
+ self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
|
||||
self.b('')
|
||||
|
||||
for i, arg in enumerate(args):
|
||||
@@ -209,36 +205,8 @@ def do_signal(self, iface, signal):
|
||||
self.b(' g_value_unset (args->values + %d);' % i)
|
||||
self.b(' g_value_init (args->values + %d, %s);' % (i, gtype))
|
||||
|
||||
- if gtype == 'G_TYPE_STRING':
|
||||
- self.b(' g_value_set_string (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif marshaller == 'BOXED':
|
||||
- self.b(' g_value_set_boxed (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_UCHAR':
|
||||
- self.b(' g_value_set_uchar (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_BOOLEAN':
|
||||
- self.b(' g_value_set_boolean (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_INT':
|
||||
- self.b(' g_value_set_int (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_UINT':
|
||||
- self.b(' g_value_set_uint (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_INT64':
|
||||
- self.b(' g_value_set_int (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_UINT64':
|
||||
- self.b(' g_value_set_uint64 (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_DOUBLE':
|
||||
- self.b(' g_value_set_double (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- else:
|
||||
- assert False, ("Don't know how to put %s in a GValue"
|
||||
- % gtype)
|
||||
+ self.b(' ' + copy_into_gvalue('args->values + %d' % i,
|
||||
+ gtype, marshaller, name))
|
||||
self.b('')
|
||||
|
||||
self.b(' tp_proxy_signal_connection_v0_take_results (sc, args);')
|
||||
@@ -288,12 +256,14 @@ def do_signal(self, iface, signal):
|
||||
self.b(' weak_object);')
|
||||
self.b('')
|
||||
|
||||
+ self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
|
||||
if len(args) > 0:
|
||||
self.b(' g_value_array_free (args);')
|
||||
else:
|
||||
self.b(' if (args != NULL)')
|
||||
self.b(' g_value_array_free (args);')
|
||||
self.b('')
|
||||
+ self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
|
||||
|
||||
self.b(' g_object_unref (tpproxy);')
|
||||
self.b('}')
|
||||
@@ -559,11 +529,13 @@ def do_method(self, iface, method):
|
||||
self.b(' return;')
|
||||
self.b(' }')
|
||||
self.b('')
|
||||
+ self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
|
||||
self.b(' args = g_value_array_new (%d);' % len(out_args))
|
||||
self.b(' g_value_init (&blank, G_TYPE_INT);')
|
||||
self.b('')
|
||||
self.b(' for (i = 0; i < %d; i++)' % len(out_args))
|
||||
self.b(' g_value_array_append (args, &blank);')
|
||||
+ self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
|
||||
|
||||
for i, arg in enumerate(out_args):
|
||||
name, info, tp_type, elt = arg
|
||||
@@ -573,36 +545,8 @@ def do_method(self, iface, method):
|
||||
self.b(' g_value_unset (args->values + %d);' % i)
|
||||
self.b(' g_value_init (args->values + %d, %s);' % (i, gtype))
|
||||
|
||||
- if gtype == 'G_TYPE_STRING':
|
||||
- self.b(' g_value_take_string (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif marshaller == 'BOXED':
|
||||
- self.b(' g_value_take_boxed (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_UCHAR':
|
||||
- self.b(' g_value_set_uchar (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_BOOLEAN':
|
||||
- self.b(' g_value_set_boolean (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_INT':
|
||||
- self.b(' g_value_set_int (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_UINT':
|
||||
- self.b(' g_value_set_uint (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_INT64':
|
||||
- self.b(' g_value_set_int (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_UINT64':
|
||||
- self.b(' g_value_set_uint (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- elif gtype == 'G_TYPE_DOUBLE':
|
||||
- self.b(' g_value_set_double (args->values + %d, %s);'
|
||||
- % (i, name))
|
||||
- else:
|
||||
- assert False, ("Don't know how to put %s in a GValue"
|
||||
- % gtype)
|
||||
+ self.b(' ' + copy_into_gvalue('args->values + %d' % i,
|
||||
+ gtype, marshaller, name))
|
||||
|
||||
self.b(' tp_proxy_pending_call_v0_take_results (user_data, '
|
||||
'NULL, args);')
|
||||
@@ -671,11 +615,13 @@ def do_method(self, iface, method):
|
||||
self.b(' error, user_data, weak_object);')
|
||||
self.b('')
|
||||
|
||||
+ self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
|
||||
if len(out_args) > 0:
|
||||
self.b(' g_value_array_free (args);')
|
||||
else:
|
||||
self.b(' if (args != NULL)')
|
||||
self.b(' g_value_array_free (args);')
|
||||
+ self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
|
||||
|
||||
self.b('}')
|
||||
self.b('')
|
||||
@@ -948,11 +894,13 @@ def do_method_reentrant(self, method, iface_lc, member, member_lc, in_args,
|
||||
|
||||
self.b('')
|
||||
|
||||
+ self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
|
||||
if len(out_args) > 0:
|
||||
self.b(' g_value_array_free (args);')
|
||||
else:
|
||||
self.b(' if (args != NULL)')
|
||||
self.b(' g_value_array_free (args);')
|
||||
+ self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
|
||||
|
||||
self.b('}')
|
||||
self.b('')
|
||||
@@ -1191,7 +1139,7 @@ def __call__(self):
|
||||
self.b('')
|
||||
|
||||
nodes = self.dom.getElementsByTagName('node')
|
||||
- nodes.sort(cmp_by_name)
|
||||
+ nodes.sort(key=key_by_name)
|
||||
|
||||
for node in nodes:
|
||||
self.do_interface(node)
|
||||
@@ -1244,9 +1192,9 @@ def __call__(self):
|
||||
self.h('#endif /* defined (%s) */' % self.guard)
|
||||
self.h('')
|
||||
|
||||
- file_set_contents(self.basename + '.h', '\n'.join(self.__header))
|
||||
- file_set_contents(self.basename + '-body.h', '\n'.join(self.__body))
|
||||
- file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
|
||||
+ file_set_contents(self.basename + '.h', u('\n').join(self.__header).encode('utf-8'))
|
||||
+ file_set_contents(self.basename + '-body.h', u('\n').join(self.__body).encode('utf-8'))
|
||||
+ file_set_contents(self.basename + '-gtk-doc.h', u('\n').join(self.__docs).encode('utf-8'))
|
||||
|
||||
def types_to_gtypes(types):
|
||||
return [type_to_gtype(t)[1] for t in types]
|
||||
diff --git a/tools/glib-client-marshaller-gen.py b/tools/glib-client-marshaller-gen.py
|
||||
index cb27d638a..cd9823bdf 100644
|
||||
--- a/tools/glib-client-marshaller-gen.py
|
||||
+++ b/tools/glib-client-marshaller-gen.py
|
||||
@@ -31,23 +31,23 @@ 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 = list(self.marshallers.keys())
|
||||
all.sort()
|
||||
for marshaller in all:
|
||||
rhs = self.marshallers[marshaller]
|
||||
|
||||
- print ' dbus_g_object_register_marshaller ('
|
||||
- print ' g_cclosure_marshal_generic,'
|
||||
- print ' G_TYPE_NONE, /* return */'
|
||||
+ print(' dbus_g_object_register_marshaller (')
|
||||
+ print(' g_cclosure_marshal_generic,')
|
||||
+ 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-errors-check-gen.py b/tools/glib-errors-check-gen.py
|
||||
index 553fc9caf..fad261ece 100644
|
||||
--- a/tools/glib-errors-check-gen.py
|
||||
+++ b/tools/glib-errors-check-gen.py
|
||||
@@ -12,13 +12,13 @@ def __init__(self, dom):
|
||||
|
||||
def __call__(self):
|
||||
|
||||
- print '{'
|
||||
- print ' GEnumClass *klass;'
|
||||
- print ' GEnumValue *value_by_name;'
|
||||
- print ' GEnumValue *value_by_nick;'
|
||||
- print ''
|
||||
- print ' g_type_init ();'
|
||||
- print ' klass = g_type_class_ref (TP_TYPE_ERROR);'
|
||||
+ print('{')
|
||||
+ print(' GEnumClass *klass;')
|
||||
+ print(' GEnumValue *value_by_name;')
|
||||
+ print(' GEnumValue *value_by_nick;')
|
||||
+ print('')
|
||||
+ print(' g_type_init ();')
|
||||
+ print(' klass = g_type_class_ref (TP_TYPE_ERROR);')
|
||||
|
||||
for error in self.errors.getElementsByTagNameNS(NS_TP, 'error'):
|
||||
ns = error.parentNode.getAttribute('namespace')
|
||||
@@ -28,30 +28,30 @@ def __call__(self):
|
||||
s = ('TP_ERROR_STR_' +
|
||||
error.getAttribute('name').replace(' ', '_').replace('.', '_').upper())
|
||||
|
||||
- print ''
|
||||
- print ' /* %s.%s */' % (ns, nick)
|
||||
- print (' value_by_name = g_enum_get_value_by_name (klass, "%s");'
|
||||
- % enum)
|
||||
- print (' value_by_nick = g_enum_get_value_by_nick (klass, "%s");'
|
||||
- % nick)
|
||||
- print (' g_assert (value_by_name != NULL);')
|
||||
- print (' g_assert (value_by_nick != NULL);')
|
||||
- print (' g_assert_cmpint (value_by_name->value, ==, %s);'
|
||||
- % enum)
|
||||
- print (' g_assert_cmpint (value_by_nick->value, ==, %s);'
|
||||
- % enum)
|
||||
- print (' g_assert_cmpstr (value_by_name->value_name, ==, "%s");'
|
||||
- % enum)
|
||||
- print (' g_assert_cmpstr (value_by_nick->value_name, ==, "%s");'
|
||||
- % enum)
|
||||
- print (' g_assert_cmpstr (value_by_name->value_nick, ==, "%s");'
|
||||
- % nick)
|
||||
- print (' g_assert_cmpstr (value_by_nick->value_nick, ==, "%s");'
|
||||
- % nick)
|
||||
- print (' g_assert_cmpstr (%s, ==, TP_ERROR_PREFIX ".%s");'
|
||||
- % (s, nick))
|
||||
-
|
||||
- print '}'
|
||||
+ print('')
|
||||
+ print(' /* %s.%s */' % (ns, nick))
|
||||
+ print(' value_by_name = g_enum_get_value_by_name (klass, "%s");'
|
||||
+ % enum)
|
||||
+ print(' value_by_nick = g_enum_get_value_by_nick (klass, "%s");'
|
||||
+ % nick)
|
||||
+ print(' g_assert (value_by_name != NULL);')
|
||||
+ print(' g_assert (value_by_nick != NULL);')
|
||||
+ print(' g_assert_cmpint (value_by_name->value, ==, %s);'
|
||||
+ % enum)
|
||||
+ print(' g_assert_cmpint (value_by_nick->value, ==, %s);'
|
||||
+ % enum)
|
||||
+ print(' g_assert_cmpstr (value_by_name->value_name, ==, "%s");'
|
||||
+ % enum)
|
||||
+ print(' g_assert_cmpstr (value_by_nick->value_name, ==, "%s");'
|
||||
+ % enum)
|
||||
+ print(' g_assert_cmpstr (value_by_name->value_nick, ==, "%s");'
|
||||
+ % nick)
|
||||
+ print(' g_assert_cmpstr (value_by_nick->value_nick, ==, "%s");'
|
||||
+ % nick)
|
||||
+ print(' g_assert_cmpstr (%s, ==, TP_ERROR_PREFIX ".%s");'
|
||||
+ % (s, nick))
|
||||
+
|
||||
+ print('}')
|
||||
|
||||
if __name__ == '__main__':
|
||||
argv = sys.argv[1:]
|
||||
diff --git a/tools/glib-errors-str-gen.py b/tools/glib-errors-str-gen.py
|
||||
index b2cf520bd..ddb1e16b7 100644
|
||||
--- a/tools/glib-errors-str-gen.py
|
||||
+++ b/tools/glib-errors-str-gen.py
|
||||
@@ -3,7 +3,7 @@
|
||||
import sys
|
||||
import xml.dom.minidom
|
||||
|
||||
-from libtpcodegen import file_set_contents
|
||||
+from libtpcodegen import file_set_contents, u
|
||||
from libglibcodegen import NS_TP, get_docstring, xml_escape
|
||||
|
||||
class Generator(object):
|
||||
@@ -17,18 +17,12 @@ def __init__(self, dom, basename):
|
||||
self.__docs = []
|
||||
|
||||
def h(self, s):
|
||||
- if isinstance(s, unicode):
|
||||
- s = s.encode('utf-8')
|
||||
self.__header.append(s)
|
||||
|
||||
def b(self, s):
|
||||
- if isinstance(s, unicode):
|
||||
- s = s.encode('utf-8')
|
||||
self.__body.append(s)
|
||||
|
||||
def d(self, s):
|
||||
- if isinstance(s, unicode):
|
||||
- s = s.encode('utf-8')
|
||||
self.__docs.append(s)
|
||||
|
||||
def __call__(self):
|
||||
@@ -72,9 +66,9 @@ def __call__(self):
|
||||
self.h('')
|
||||
self.b('')
|
||||
|
||||
- file_set_contents(self.basename + '.h', '\n'.join(self.__header))
|
||||
- file_set_contents(self.basename + '.c', '\n'.join(self.__body))
|
||||
- file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
|
||||
+ file_set_contents(self.basename + '.h', u('\n').join(self.__header).encode('utf-8'))
|
||||
+ file_set_contents(self.basename + '.c', u('\n').join(self.__body).encode('utf-8'))
|
||||
+ file_set_contents(self.basename + '-gtk-doc.h', u('\n').join(self.__docs).encode('utf-8'))
|
||||
|
||||
if __name__ == '__main__':
|
||||
argv = sys.argv[1:]
|
||||
diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py
|
||||
index 6fec0d3c4..c0ce20ddc 100644
|
||||
--- a/tools/glib-ginterface-gen.py
|
||||
+++ b/tools/glib-ginterface-gen.py
|
||||
@@ -26,8 +26,8 @@
|
||||
import os.path
|
||||
import xml.dom.minidom
|
||||
|
||||
-from libtpcodegen import file_set_contents
|
||||
-from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
|
||||
+from libtpcodegen import file_set_contents, key_by_name, u
|
||||
+from libglibcodegen import Signature, type_to_gtype, \
|
||||
NS_TP, dbus_gutils_wincaps_to_uscore
|
||||
|
||||
|
||||
@@ -85,18 +85,12 @@ def __init__(self, dom, prefix, basename, signal_marshal_prefix,
|
||||
self.allow_havoc = allow_havoc
|
||||
|
||||
def h(self, s):
|
||||
- if isinstance(s, unicode):
|
||||
- s = s.encode('utf-8')
|
||||
self.__header.append(s)
|
||||
|
||||
def b(self, s):
|
||||
- if isinstance(s, unicode):
|
||||
- s = s.encode('utf-8')
|
||||
self.__body.append(s)
|
||||
|
||||
def d(self, s):
|
||||
- if isinstance(s, unicode):
|
||||
- s = s.encode('utf-8')
|
||||
self.__docs.append(s)
|
||||
|
||||
def do_node(self, node):
|
||||
@@ -733,7 +727,7 @@ def have_properties(self, nodes):
|
||||
|
||||
def __call__(self):
|
||||
nodes = self.dom.getElementsByTagName('node')
|
||||
- nodes.sort(cmp_by_name)
|
||||
+ nodes.sort(key=key_by_name)
|
||||
|
||||
self.h('#include <glib-object.h>')
|
||||
self.h('#include <dbus/dbus-glib.h>')
|
||||
@@ -761,12 +755,12 @@ def __call__(self):
|
||||
|
||||
self.h('')
|
||||
self.b('')
|
||||
- file_set_contents(self.basename + '.h', '\n'.join(self.__header))
|
||||
- file_set_contents(self.basename + '.c', '\n'.join(self.__body))
|
||||
- file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
|
||||
+ file_set_contents(self.basename + '.h', u('\n').join(self.__header).encode('utf-8'))
|
||||
+ file_set_contents(self.basename + '.c', u('\n').join(self.__body).encode('utf-8'))
|
||||
+ file_set_contents(self.basename + '-gtk-doc.h', u('\n').join(self.__docs).encode('utf-8'))
|
||||
|
||||
def cmdline_error():
|
||||
- print """\
|
||||
+ print("""\
|
||||
usage:
|
||||
gen-ginterface [OPTIONS] xmlfile Prefix_
|
||||
options:
|
||||
@@ -786,7 +780,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-gtypes-generator.py b/tools/glib-gtypes-generator.py
|
||||
index 21dfc6aa7..1477bd37b 100644
|
||||
--- a/tools/glib-gtypes-generator.py
|
||||
+++ b/tools/glib-gtypes-generator.py
|
||||
@@ -23,7 +23,7 @@
|
||||
import sys
|
||||
import xml.dom.minidom
|
||||
|
||||
-from libtpcodegen import file_set_contents
|
||||
+from libtpcodegen import file_set_contents, u
|
||||
from libglibcodegen import escape_as_identifier, \
|
||||
get_docstring, \
|
||||
NS_TP, \
|
||||
@@ -68,13 +68,13 @@ def __init__(self, dom, output, mixed_case_prefix):
|
||||
self.need_other_arrays = {}
|
||||
|
||||
def h(self, code):
|
||||
- self.header.append(code.encode("utf-8"))
|
||||
+ self.header.append(code)
|
||||
|
||||
def c(self, code):
|
||||
- self.body.append(code.encode("utf-8"))
|
||||
+ self.body.append(code)
|
||||
|
||||
def d(self, code):
|
||||
- self.docs.append(code.encode('utf-8'))
|
||||
+ self.docs.append(code)
|
||||
|
||||
def do_mapping_header(self, mapping):
|
||||
members = mapping.getElementsByTagNameNS(NS_TP, 'member')
|
||||
@@ -292,9 +292,9 @@ def __call__(self):
|
||||
self.c(' return t;\n')
|
||||
self.c('}\n\n')
|
||||
|
||||
- file_set_contents(self.output + '.h', ''.join(self.header))
|
||||
- file_set_contents(self.output + '-body.h', ''.join(self.body))
|
||||
- file_set_contents(self.output + '-gtk-doc.h', ''.join(self.docs))
|
||||
+ file_set_contents(self.output + '.h', u('').join(self.header).encode('utf-8'))
|
||||
+ file_set_contents(self.output + '-body.h', u('').join(self.body).encode('utf-8'))
|
||||
+ file_set_contents(self.output + '-gtk-doc.h', u('').join(self.docs).encode('utf-8'))
|
||||
|
||||
if __name__ == '__main__':
|
||||
argv = sys.argv[1:]
|
||||
diff --git a/tools/glib-interfaces-gen.py b/tools/glib-interfaces-gen.py
|
||||
index 410762cde..b67d7b4f0 100644
|
||||
--- a/tools/glib-interfaces-gen.py
|
||||
+++ b/tools/glib-interfaces-gen.py
|
||||
@@ -3,7 +3,7 @@
|
||||
from sys import argv, stdout, stderr
|
||||
import xml.dom.minidom
|
||||
|
||||
-from libtpcodegen import file_set_contents
|
||||
+from libtpcodegen import file_set_contents, u
|
||||
from libglibcodegen import NS_TP, get_docstring, \
|
||||
get_descendant_text, get_by_path
|
||||
|
||||
@@ -24,22 +24,22 @@ def __init__(self, prefix, implfile, declfile, dom):
|
||||
self.spec = get_by_path(dom, "spec")[0]
|
||||
|
||||
def h(self, code):
|
||||
- self.decls.append(code.encode('utf-8'))
|
||||
+ self.decls.append(code)
|
||||
|
||||
def c(self, code):
|
||||
- self.impls.append(code.encode('utf-8'))
|
||||
+ self.impls.append(code)
|
||||
|
||||
def d(self, code):
|
||||
- self.docs.append(code.encode('utf-8'))
|
||||
+ self.docs.append(code)
|
||||
|
||||
def __call__(self):
|
||||
for f in self.h, self.c:
|
||||
self.do_header(f)
|
||||
self.do_body()
|
||||
|
||||
- file_set_contents(self.implfile, ''.join(self.impls))
|
||||
- file_set_contents(self.declfile, ''.join(self.decls))
|
||||
- file_set_contents(self.docfile, ''.join(self.docs))
|
||||
+ file_set_contents(self.implfile, u('').join(self.impls).encode('utf-8'))
|
||||
+ file_set_contents(self.declfile, u('').join(self.decls).encode('utf-8'))
|
||||
+ file_set_contents(self.docfile, u('').join(self.docs).encode('utf-8'))
|
||||
|
||||
# Header
|
||||
def do_header(self, f):
|
||||
diff --git a/tools/gobject-foo.py b/tools/gobject-foo.py
|
||||
index 002a290ba..a2abd7667 100644
|
||||
--- a/tools/gobject-foo.py
|
||||
+++ b/tools/gobject-foo.py
|
||||
@@ -87,4 +87,4 @@ def gobject_header(head, tail, as_interface=False):
|
||||
|
||||
head, tail = argv
|
||||
|
||||
- print '\n'.join(gobject_header(head, tail, as_interface=as_interface))
|
||||
+ print('\n'.join(gobject_header(head, tail, as_interface=as_interface)))
|
||||
diff --git a/tools/libglibcodegen.py b/tools/libglibcodegen.py
|
||||
index 6a9d21485..0b703a5a8 100644
|
||||
--- a/tools/libglibcodegen.py
|
||||
+++ b/tools/libglibcodegen.py
|
||||
@@ -154,7 +154,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)
|
||||
@@ -169,4 +169,27 @@ 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 copy_into_gvalue(gvaluep, gtype, marshaller, name):
|
||||
+ if gtype == 'G_TYPE_STRING':
|
||||
+ return 'g_value_set_string (%s, %s);' % (gvaluep, name)
|
||||
+ elif marshaller == 'BOXED':
|
||||
+ return 'g_value_set_boxed (%s, %s);' % (gvaluep, name)
|
||||
+ elif gtype == 'G_TYPE_UCHAR':
|
||||
+ return 'g_value_set_uchar (%s, %s);' % (gvaluep, name)
|
||||
+ elif gtype == 'G_TYPE_BOOLEAN':
|
||||
+ return 'g_value_set_boolean (%s, %s);' % (gvaluep, name)
|
||||
+ elif gtype == 'G_TYPE_INT':
|
||||
+ return 'g_value_set_int (%s, %s);' % (gvaluep, name)
|
||||
+ elif gtype == 'G_TYPE_UINT':
|
||||
+ return 'g_value_set_uint (%s, %s);' % (gvaluep, name)
|
||||
+ elif gtype == 'G_TYPE_INT64':
|
||||
+ return 'g_value_set_int (%s, %s);' % (gvaluep, name)
|
||||
+ elif gtype == 'G_TYPE_UINT64':
|
||||
+ return 'g_value_set_uint64 (%s, %s);' % (gvaluep, name)
|
||||
+ elif gtype == 'G_TYPE_DOUBLE':
|
||||
+ return 'g_value_set_double (%s, %s);' % (gvaluep, name)
|
||||
+ else:
|
||||
+ raise AssertionError("Don't know how to put %s in a GValue" % gtype)
|
||||
diff --git a/tools/libtpcodegen.py b/tools/libtpcodegen.py
|
||||
index 7e9eb9a50..99de66340 100644
|
||||
--- a/tools/libtpcodegen.py
|
||||
+++ b/tools/libtpcodegen.py
|
||||
@@ -21,6 +21,7 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
import os
|
||||
+import sys
|
||||
from string import ascii_letters, digits
|
||||
|
||||
|
||||
@@ -28,6 +29,20 @@
|
||||
|
||||
_ASCII_ALNUM = ascii_letters + digits
|
||||
|
||||
+if sys.version_info[0] >= 3:
|
||||
+ def u(s):
|
||||
+ """Return s, which must be a str literal with no non-ASCII characters.
|
||||
+ This is like a more restricted form of the Python 2 u'' syntax.
|
||||
+ """
|
||||
+ return s.encode('ascii').decode('ascii')
|
||||
+else:
|
||||
+ def u(s):
|
||||
+ """Return a Unicode version of s, which must be a str literal
|
||||
+ (a bytestring) in which each byte is an ASCII character.
|
||||
+ This is like a more restricted form of the u'' syntax.
|
||||
+ """
|
||||
+ return s.decode('ascii')
|
||||
+
|
||||
def file_set_contents(filename, contents):
|
||||
try:
|
||||
os.remove(filename)
|
||||
@@ -38,13 +53,15 @@ def file_set_contents(filename, contents):
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
- open(filename + '.tmp', 'w').write(contents)
|
||||
+ open(filename + '.tmp', 'wb').write(contents)
|
||||
os.rename(filename + '.tmp', filename)
|
||||
|
||||
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 escape_as_identifier(identifier):
|
||||
"""Escape the given string to be a valid D-Bus object path or service
|
||||
@@ -168,6 +185,9 @@ def __init__(self, string):
|
||||
self.remaining = string
|
||||
|
||||
def next(self):
|
||||
+ return self.__next__()
|
||||
+
|
||||
+ def __next__(self):
|
||||
if self.remaining == '':
|
||||
raise StopIteration
|
||||
|
||||
diff --git a/tools/make-version-script.py b/tools/make-version-script.py
|
||||
index 0d30aa323..4ced849fe 100644
|
||||
--- a/tools/make-version-script.py
|
||||
+++ b/tools/make-version-script.py
|
||||
@@ -63,9 +63,9 @@ def main(abifiles, symbols=None, unreleased_version=None,
|
||||
|
||||
if dpkg:
|
||||
assert dpkg_first_line is not None
|
||||
- print dpkg_first_line
|
||||
+ print(dpkg_first_line)
|
||||
if dpkg_build_depends_package is not None:
|
||||
- print "* Build-Depends-Package: %s" % dpkg_build_depends_package
|
||||
+ print("* Build-Depends-Package: %s" % dpkg_build_depends_package)
|
||||
|
||||
for filename in abifiles:
|
||||
lines = open(filename, 'r').readlines()
|
||||
@@ -120,8 +120,8 @@ def main(abifiles, symbols=None, unreleased_version=None,
|
||||
lines = lines[cut:]
|
||||
|
||||
if gnuld:
|
||||
- print "%s {" % version
|
||||
- print " global:"
|
||||
+ print("%s {" % version)
|
||||
+ print(" global:")
|
||||
|
||||
for symbol in lines:
|
||||
symbol = symbol.strip()
|
||||
@@ -130,7 +130,7 @@ def main(abifiles, symbols=None, unreleased_version=None,
|
||||
continue
|
||||
|
||||
if gnuld:
|
||||
- print " %s;" % symbol
|
||||
+ print(" %s;" % symbol)
|
||||
elif dpkg:
|
||||
dpkg_symbols.append('%s@%s %s' % (symbol, version, release))
|
||||
|
||||
@@ -142,22 +142,22 @@ def main(abifiles, symbols=None, unreleased_version=None,
|
||||
|
||||
if gnuld:
|
||||
if extends == '-':
|
||||
- print " local:"
|
||||
- print " *;"
|
||||
- print "};"
|
||||
+ print(" local:")
|
||||
+ print(" *;")
|
||||
+ print("};")
|
||||
else:
|
||||
- print "} %s;" % extends
|
||||
- print
|
||||
+ print("} %s;" % extends)
|
||||
+ print("")
|
||||
|
||||
if dpkg:
|
||||
dpkg_symbols.sort()
|
||||
dpkg_versions.sort()
|
||||
|
||||
for x in dpkg_versions:
|
||||
- print " %s" % x
|
||||
+ print(" %s" % x)
|
||||
|
||||
for x in dpkg_symbols:
|
||||
- print " %s" % x
|
||||
+ print(" %s" % x)
|
||||
|
||||
if symbol_set is not None:
|
||||
missing = versioned_symbols - symbol_set
|
||||
@@ -182,13 +182,13 @@ def main(abifiles, symbols=None, unreleased_version=None,
|
||||
raise SystemExit(1)
|
||||
|
||||
if gnuld:
|
||||
- print "%s {" % unreleased_version
|
||||
- print " global:"
|
||||
+ print("%s {" % unreleased_version)
|
||||
+ print(" global:")
|
||||
|
||||
for symbol in unreleased:
|
||||
- print " %s;" % symbol
|
||||
+ print(" %s;" % symbol)
|
||||
|
||||
- print "} %s;" % version
|
||||
+ print("} %s;" % version)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
diff --git a/tools/xincludator.py b/tools/xincludator.py
|
||||
index 63e106ace..f9ed49ce4 100644
|
||||
--- a/tools/xincludator.py
|
||||
+++ b/tools/xincludator.py
|
||||
@@ -1,17 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
+import sys
|
||||
from sys import argv, stdout, stderr
|
||||
import codecs, locale
|
||||
import os
|
||||
import xml.dom.minidom
|
||||
|
||||
-stdout = codecs.getwriter('utf-8')(stdout)
|
||||
+if sys.version_info[0] < 3:
|
||||
+ stdout = codecs.getwriter('utf-8')(stdout)
|
||||
|
||||
NS_XI = 'http://www.w3.org/2001/XInclude'
|
||||
|
||||
def xincludate(dom, base, dropns = []):
|
||||
remove_attrs = []
|
||||
- for i in xrange(dom.documentElement.attributes.length):
|
||||
+ for i in range(dom.documentElement.attributes.length):
|
||||
attr = dom.documentElement.attributes.item(i)
|
||||
if attr.prefix == 'xmlns':
|
||||
if attr.localName in dropns:
|
||||
@@ -34,6 +36,11 @@ def xincludate(dom, base, dropns = []):
|
||||
argv = argv[1:]
|
||||
dom = xml.dom.minidom.parse(argv[0])
|
||||
xincludate(dom, argv[0])
|
||||
- xml = dom.toxml()
|
||||
+
|
||||
+ if sys.version_info[0] >= 3:
|
||||
+ xml = dom.toxml(encoding=None)
|
||||
+ else:
|
||||
+ xml = dom.toxml()
|
||||
+
|
||||
stdout.write(xml)
|
||||
stdout.write('\n')
|
||||
--- a/plugins/telepathy-gabble-xmpp-console
|
||||
+++ b/plugins/telepathy-gabble-xmpp-console
|
||||
@@ -313,12 +313,12 @@
|
||||
CONN_FUTURE_IFACE, None)
|
||||
try:
|
||||
sidecar_path, _ = conn_future_proxy.EnsureSidecar('(s)', CONSOLE_IFACE)
|
||||
- except Exception, e:
|
||||
- print """
|
||||
+ except Exception as e:
|
||||
+ print("""
|
||||
Couldn't connect to the XMPP console interface on '%(connection_bus_name)s':
|
||||
%(e)s
|
||||
Check that it's a running Jabber connection, and that you have the console
|
||||
-plugin installed.""" % locals()
|
||||
+plugin installed.""" % locals())
|
||||
|
||||
raise SystemExit(2)
|
||||
|
||||
@@ -357,7 +357,7 @@
|
||||
ACCOUNT_IFACE = 'org.freedesktop.Telepathy.Account'
|
||||
|
||||
def usage():
|
||||
- print """
|
||||
+ print("""
|
||||
Usage:
|
||||
|
||||
%(arg0)s gabble/jabber/blahblah
|
||||
@@ -367,7 +367,7 @@
|
||||
List connection bus names using `qdbus | grep gabble`.
|
||||
""" % { 'arg0': sys.argv[0],
|
||||
'prefix': GABBLE_PREFIX,
|
||||
- }
|
||||
+ })
|
||||
raise SystemExit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -385,7 +385,7 @@
|
||||
ACCOUNT_IFACE, None)
|
||||
path = account_proxy.get_cached_property('Connection').get_string()
|
||||
if path == '/':
|
||||
- print "%s is not online" % thing
|
||||
+ print("%s is not online" % thing)
|
||||
raise SystemExit(1)
|
||||
else:
|
||||
thing = nameify(path)
|
|
@ -1,11 +1,11 @@
|
|||
# Template file for 'telepathy-gabble'
|
||||
pkgname=telepathy-gabble
|
||||
version=0.18.4
|
||||
revision=3
|
||||
revision=4
|
||||
build_style=gnu-configure
|
||||
configure_args="--with-ca-certificates=/etc/ssl/certs/ca-certificates.crt
|
||||
--enable-handle-leak-debug --disable-debug --disable-static"
|
||||
hostmakedepends="python pkg-config libxslt"
|
||||
hostmakedepends="python3 pkg-config libxslt"
|
||||
makedepends="glib-devel dbus-glib-devel libxml2-devel
|
||||
sqlite-devel gnutls-devel telepathy-glib-devel libsoup-devel
|
||||
libnice-devel ca-certificates"
|
||||
|
@ -14,8 +14,8 @@ short_desc="Jabber/XMPP connection manager for Telepathy"
|
|||
maintainer="Orphaned <orphan@voidlinux.org>"
|
||||
license="LGPL-2.1-or-later"
|
||||
homepage="https://telepathy.freedesktop.org"
|
||||
distfiles="$homepage/releases/$pkgname/$pkgname-$version.tar.gz"
|
||||
distfiles="https://telepathy.freedesktop.org/releases/telepathy-gabble/telepathy-gabble-$version.tar.gz"
|
||||
checksum=115c91572c72d4a40f0b25b606167b4f2f09441dc7bf1036ccbb1450f1a4969c
|
||||
python_version=2
|
||||
python_version=3
|
||||
nocross=yes
|
||||
lib32disabled=yes
|
||||
|
|
Loading…
Reference in New Issue