1 diff -up telepathy-gabble-0.18.4/tools/c-constants-gen.py.py3 telepathy-gabble-0.18.4/tools/c-constants-gen.py
2 --- telepathy-gabble-0.18.4/tools/c-constants-gen.py.py3 2016-11-15 04:06:40.000000000 -0500
3 +++ telepathy-gabble-0.18.4/tools/c-constants-gen.py 2019-12-20 10:28:02.467810478 -0500
4 @@ -12,7 +12,7 @@ class Generator(object):
5 self.prefix = prefix + '_'
6 self.spec = get_by_path(dom, "spec")[0]
8 - self.output_base = output_base
9 + self.output_base = output_base
13 @@ -25,10 +25,10 @@ class Generator(object):
14 file_set_contents(self.output_base + '-gtk-doc.h', ''.join(self.__docs))
16 def write(self, code):
17 - self.__header.append(code.encode('utf-8'))
18 + self.__header.append(code)
21 - self.__docs.append(code.encode('utf-8'))
22 + self.__docs.append(code)
26 diff -up telepathy-gabble-0.18.4/tools/glib-client-gen.py.py3 telepathy-gabble-0.18.4/tools/glib-client-gen.py
27 --- telepathy-gabble-0.18.4/tools/glib-client-gen.py.py3 2016-11-15 04:03:24.000000000 -0500
28 +++ telepathy-gabble-0.18.4/tools/glib-client-gen.py 2019-12-20 10:27:54.390926615 -0500
29 @@ -74,17 +74,17 @@ class Generator(object):
30 self.guard = opts.get('--guard', None)
33 - if isinstance(s, unicode):
34 + if isinstance(s, str):
36 self.__header.append(s)
39 - if isinstance(s, unicode):
40 + if isinstance(s, str):
45 - if isinstance(s, unicode):
46 + if isinstance(s, str):
50 diff -up telepathy-gabble-0.18.4/tools/glib-client-marshaller-gen.py.py3 telepathy-gabble-0.18.4/tools/glib-client-marshaller-gen.py
51 --- telepathy-gabble-0.18.4/tools/glib-client-marshaller-gen.py.py3 2016-11-15 04:06:40.000000000 -0500
52 +++ telepathy-gabble-0.18.4/tools/glib-client-marshaller-gen.py 2019-12-20 10:28:02.468810464 -0500
53 @@ -31,23 +31,23 @@ class Generator(object):
54 for signal in signals:
55 self.do_signal(signal)
58 - print '%s_register_dbus_glib_marshallers (void)' % self.prefix
61 + print('%s_register_dbus_glib_marshallers (void)' % self.prefix)
64 - all = self.marshallers.keys()
66 + all = list(self.marshallers.keys())
68 for marshaller in all:
69 rhs = self.marshallers[marshaller]
71 - print ' dbus_g_object_register_marshaller ('
72 - print ' g_cclosure_marshal_generic,'
73 - print ' G_TYPE_NONE, /* return */'
74 + print(' dbus_g_object_register_marshaller (')
75 + print(' g_cclosure_marshal_generic,')
76 + print(' G_TYPE_NONE, /* return */')
78 - print ' G_TYPE_%s,' % type.replace('VOID', 'NONE')
79 - print ' G_TYPE_INVALID);'
80 + print(' G_TYPE_%s,' % type.replace('VOID', 'NONE'))
81 + print(' G_TYPE_INVALID);')
87 def types_to_gtypes(types):
88 diff -up telepathy-gabble-0.18.4/tools/glib-errors-str-gen.py.py3 telepathy-gabble-0.18.4/tools/glib-errors-str-gen.py
89 --- telepathy-gabble-0.18.4/tools/glib-errors-str-gen.py.py3 2016-11-15 04:03:24.000000000 -0500
90 +++ telepathy-gabble-0.18.4/tools/glib-errors-str-gen.py 2019-12-20 10:27:54.390926615 -0500
91 @@ -17,17 +17,17 @@ class Generator(object):
95 - if isinstance(s, unicode):
96 + if isinstance(s, str):
98 self.__header.append(s)
101 - if isinstance(s, unicode):
102 + if isinstance(s, str):
103 s = s.encode('utf-8')
104 self.__body.append(s)
107 - if isinstance(s, unicode):
108 + if isinstance(s, str):
109 s = s.encode('utf-8')
110 self.__docs.append(s)
112 diff -up telepathy-gabble-0.18.4/tools/glib-ginterface-gen.py.py3 telepathy-gabble-0.18.4/tools/glib-ginterface-gen.py
113 --- telepathy-gabble-0.18.4/tools/glib-ginterface-gen.py.py3 2016-11-15 04:03:24.000000000 -0500
114 +++ telepathy-gabble-0.18.4/tools/glib-ginterface-gen.py 2019-12-20 10:27:54.391926600 -0500
115 @@ -27,7 +27,7 @@ import os.path
116 import xml.dom.minidom
118 from libtpcodegen import file_set_contents
119 -from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
120 +from libglibcodegen import Signature, type_to_gtype, \
121 NS_TP, dbus_gutils_wincaps_to_uscore
124 @@ -85,18 +85,18 @@ class Generator(object):
125 self.allow_havoc = allow_havoc
128 - if isinstance(s, unicode):
129 - s = s.encode('utf-8')
130 + if isinstance(s, bytes):
131 + s = str(s, 'ascii')
132 self.__header.append(s)
135 - if isinstance(s, unicode):
136 - s = s.encode('utf-8')
137 + if isinstance(s, bytes):
138 + s = str(s, 'ascii')
139 self.__body.append(s)
142 - if isinstance(s, unicode):
143 - s = s.encode('utf-8')
144 + if isinstance(s, bytes):
145 + s = str(s, 'ascii')
146 self.__docs.append(s)
148 def do_node(self, node):
149 @@ -733,7 +733,7 @@ class Generator(object):
152 nodes = self.dom.getElementsByTagName('node')
153 - nodes.sort(cmp_by_name)
154 + nodes.sort(key=lambda node : node.getAttributeNode('name').nodeValue)
156 self.h('#include <glib-object.h>')
157 self.h('#include <dbus/dbus-glib.h>')
158 @@ -766,7 +766,7 @@ class Generator(object):
159 file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
165 gen-ginterface [OPTIONS] xmlfile Prefix_
167 @@ -786,7 +786,7 @@ options:
168 void symbol (DBusGMethodInvocation *context)
169 and return some sort of "not implemented" error via
170 dbus_g_method_return_error (context, ...)
176 diff -up telepathy-gabble-0.18.4/tools/glib-gtypes-generator.py.py3 telepathy-gabble-0.18.4/tools/glib-gtypes-generator.py
177 --- telepathy-gabble-0.18.4/tools/glib-gtypes-generator.py.py3 2016-11-15 04:03:24.000000000 -0500
178 +++ telepathy-gabble-0.18.4/tools/glib-gtypes-generator.py 2019-12-20 10:27:54.391926600 -0500
179 @@ -68,13 +68,13 @@ class GTypesGenerator(object):
180 self.need_other_arrays = {}
183 - self.header.append(code.encode("utf-8"))
184 + self.header.append(code)
187 - self.body.append(code.encode("utf-8"))
188 + self.body.append(code)
191 - self.docs.append(code.encode('utf-8'))
192 + self.docs.append(code)
194 def do_mapping_header(self, mapping):
195 members = mapping.getElementsByTagNameNS(NS_TP, 'member')
196 diff -up telepathy-gabble-0.18.4/tools/glib-interfaces-gen.py.py3 telepathy-gabble-0.18.4/tools/glib-interfaces-gen.py
197 --- telepathy-gabble-0.18.4/tools/glib-interfaces-gen.py.py3 2019-12-20 10:28:22.933516203 -0500
198 +++ telepathy-gabble-0.18.4/tools/glib-interfaces-gen.py 2019-12-20 10:28:40.075269728 -0500
199 @@ -24,13 +24,13 @@ class Generator(object):
200 self.spec = get_by_path(dom, "spec")[0]
203 - self.decls.append(code.encode('utf-8'))
204 + self.decls.append(code)
207 - self.impls.append(code.encode('utf-8'))
208 + self.impls.append(code)
211 - self.docs.append(code.encode('utf-8'))
212 + self.docs.append(code)
215 for f in self.h, self.c:
216 diff -up telepathy-gabble-0.18.4/tools/gobject-foo.py.py3 telepathy-gabble-0.18.4/tools/gobject-foo.py
217 --- telepathy-gabble-0.18.4/tools/gobject-foo.py.py3 2016-11-15 04:03:24.000000000 -0500
218 +++ telepathy-gabble-0.18.4/tools/gobject-foo.py 2019-12-20 10:27:54.391926600 -0500
219 @@ -87,4 +87,4 @@ if __name__ == '__main__':
223 - print '\n'.join(gobject_header(head, tail, as_interface=as_interface))
224 + print('\n'.join(gobject_header(head, tail, as_interface=as_interface)))
225 diff -up telepathy-gabble-0.18.4/tools/libglibcodegen.py.py3 telepathy-gabble-0.18.4/tools/libglibcodegen.py
226 --- telepathy-gabble-0.18.4/tools/libglibcodegen.py.py3 2016-11-15 04:03:24.000000000 -0500
227 +++ telepathy-gabble-0.18.4/tools/libglibcodegen.py 2019-12-20 10:27:54.391926600 -0500
228 @@ -23,7 +23,6 @@ please make any changes there.
230 from libtpcodegen import NS_TP, \
233 escape_as_identifier, \
235 get_descendant_text, \
236 @@ -154,7 +153,7 @@ def type_to_gtype(s):
237 return ("GHashTable *", "DBUS_TYPE_G_STRING_STRING_HASHTABLE", "BOXED", False)
238 elif s[:2] == 'a{': #some arbitrary hash tables
239 if s[2] not in ('y', 'b', 'n', 'q', 'i', 'u', 's', 'o', 'g'):
240 - raise Exception, "can't index a hashtable off non-basic type " + s
241 + raise Exception("can't index a hashtable off non-basic type " + s)
242 first = type_to_gtype(s[2])
243 second = type_to_gtype(s[3:-1])
244 return ("GHashTable *", "(dbus_g_type_get_map (\"GHashTable\", " + first[1] + ", " + second[1] + "))", "BOXED", False)
245 @@ -169,4 +168,4 @@ def type_to_gtype(s):
246 return ("GValueArray *", gtype, "BOXED", True)
248 # we just don't know ..
249 - raise Exception, "don't know the GType for " + s
250 + raise Exception("don't know the GType for " + s)
251 diff -up telepathy-gabble-0.18.4/tools/libtpcodegen.py.py3 telepathy-gabble-0.18.4/tools/libtpcodegen.py
252 --- telepathy-gabble-0.18.4/tools/libtpcodegen.py.py3 2016-11-15 04:03:24.000000000 -0500
253 +++ telepathy-gabble-0.18.4/tools/libtpcodegen.py 2019-12-20 10:27:54.391926600 -0500
254 @@ -167,7 +167,10 @@ class _SignatureIter:
255 def __init__(self, string):
256 self.remaining = string
259 + def __iter__(self):
262 + def __next__(self):
263 if self.remaining == '':
266 diff -up telepathy-gabble-0.18.4/tools/make-release-mail.py.py3 telepathy-gabble-0.18.4/tools/make-release-mail.py
267 --- telepathy-gabble-0.18.4/tools/make-release-mail.py.py3 2016-07-02 04:28:17.000000000 -0400
268 +++ telepathy-gabble-0.18.4/tools/make-release-mail.py 2019-12-20 10:27:54.391926600 -0500
269 @@ -28,8 +28,8 @@ def extract_description(package, version
272 # Skip the ====== line, and the first blank line
278 got_release_name = False
280 @@ -59,7 +59,7 @@ GIT_URL = 'http://cgit.freedesktop.org/t
281 def main(package, version, news_path):
282 release_name, details = extract_description(package, version, news_path)
288 tarball: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.gz
289 @@ -73,14 +73,14 @@ git: %(git_url)s/%(package)s
291 'release_name': release_name,
296 if __name__ == '__main__':
298 package, version, news_path = sys.argv[1:]
300 main(package, version, news_path)
301 - except ValueError, e:
302 + except ValueError as e:
304 'Usage: %s package-name package.version.number path/to/NEWS\n' %
306 diff -up telepathy-gabble-0.18.4/tools/manager-file.py.py3 telepathy-gabble-0.18.4/tools/manager-file.py
307 --- telepathy-gabble-0.18.4/tools/manager-file.py.py3 2016-07-02 04:28:17.000000000 -0400
308 +++ telepathy-gabble-0.18.4/tools/manager-file.py 2019-12-20 10:27:54.391926600 -0500
309 @@ -87,18 +87,18 @@ gflags = {
311 def write_manager(f, manager, protos):
312 # pointless backwards compat section
313 - print >> f, '[ConnectionManager]'
314 - print >> f, 'BusName=org.freedesktop.Telepathy.ConnectionManager.' + manager
315 - print >> f, 'ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/' + manager
316 + print('[ConnectionManager]', file=f)
317 + print('BusName=org.freedesktop.Telepathy.ConnectionManager.' + manager, file=f)
318 + print('ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/' + manager, file=f)
321 - for proto, params in protos.iteritems():
323 - print >> f, '[Protocol %s]' % proto
324 + for proto, params in protos.items():
326 + print('[Protocol %s]' % proto, file=f)
330 - for param, info in params.iteritems():
331 + for param, info in params.items():
332 dtype = info['dtype']
333 flags = info.get('flags', '').split()
334 struct_field = info.get('struct_field', param.replace('-', '_'))
335 @@ -115,15 +115,15 @@ def write_manager(f, manager, protos):
339 - print >> f, 'param-%s=%s%s' % (param, desktop_string(dtype), flags)
340 + print('param-%s=%s%s' % (param, desktop_string(dtype), flags), file=f)
342 - for param, default in defaults.iteritems():
343 - print >> f, 'default-%s=%s' % (param, default)
344 + for param, default in defaults.items():
345 + print('default-%s=%s' % (param, default), file=f)
347 def write_c_params(f, manager, proto, struct, params):
348 - print >> f, "static const TpCMParamSpec %s_%s_params[] = {" % (manager, proto)
349 + print("static const TpCMParamSpec %s_%s_params[] = {" % (manager, proto), file=f)
351 - for param, info in params.iteritems():
352 + for param, info in params.items():
353 dtype = info['dtype']
354 flags = info.get('flags', '').split()
355 struct_field = info.get('struct_field', param.replace('-', '_'))
356 @@ -146,7 +146,7 @@ def write_c_params(f, manager, proto, st
358 struct_offset = 'G_STRUCT_OFFSET (%s, %s)' % (struct, struct_field)
360 - print >> f, (''' { %s, %s, %s,
361 + print((''' { %s, %s, %s,
364 %s, /* struct offset */
365 @@ -154,14 +154,14 @@ def write_c_params(f, manager, proto, st
366 %s, /* filter data */
367 %s /* setter data */ },''' %
368 (c_string(param), c_string(dtype), gtypes[dtype], flags,
369 - default, struct_offset, filter, filter_data, setter_data))
370 + default, struct_offset, filter, filter_data, setter_data)), file=f)
372 - print >> f, " { NULL }"
374 + print(" { NULL }", file=f)
375 + print("};", file=f)
377 if __name__ == '__main__':
379 - execfile(sys.argv[1], environment)
380 + exec(compile(open(sys.argv[1], "rb").read(), sys.argv[1], 'exec'), environment)
382 filename = '%s/%s.manager' % (sys.argv[2], environment['MANAGER'])
384 diff -up telepathy-gabble-0.18.4/tools/xincludator.py.py3 telepathy-gabble-0.18.4/tools/xincludator.py
385 --- telepathy-gabble-0.18.4/tools/xincludator.py.py3 2016-11-15 04:03:24.000000000 -0500
386 +++ telepathy-gabble-0.18.4/tools/xincludator.py 2019-12-20 10:27:54.392926586 -0500
390 from sys import argv, stdout, stderr
391 -import codecs, locale
395 import xml.dom.minidom
397 -stdout = codecs.getwriter('utf-8')(stdout)
398 +sys.stdout.reconfigure(encoding='utf-8')
400 NS_XI = 'http://www.w3.org/2001/XInclude'
402 def xincludate(dom, base, dropns = []):
404 - for i in xrange(dom.documentElement.attributes.length):
405 + for i in range(dom.documentElement.attributes.length):
406 attr = dom.documentElement.attributes.item(i)
407 if attr.prefix == 'xmlns':
408 if attr.localName in dropns:
409 @@ -35,5 +35,5 @@ if __name__ == '__main__':
410 dom = xml.dom.minidom.parse(argv[0])
411 xincludate(dom, argv[0])
415 + sys.stdout.write(xml)
416 + sys.stdout.write('\n')