[polari] flatpak: Port telepathy build tools to Python3



commit e5c06ab25aa1e5aa4d8ef940e4e0559efdae67e8
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jul 15 20:17:29 2019 +0200

    flatpak: Port telepathy build tools to Python3
    
    The org.gnome.Sdk//master runtime no longer contains Python2, so
    we either need to build it ourselves (boo), or port the various
    scripts to Python3 (meh).
    
    https://gitlab.gnome.org/GNOME/polari/merge_requests/124

 flatpak/org.gnome.Polari.json |  12 +
 flatpak/tp-idle-python3.patch | 142 ++++++++
 flatpak/tp-mc-python3.patch   | 324 +++++++++++++++++
 flatpak/tpl-python3.patch     | 799 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1277 insertions(+)
---
diff --git a/flatpak/org.gnome.Polari.json b/flatpak/org.gnome.Polari.json
index e588d6c..db62288 100644
--- a/flatpak/org.gnome.Polari.json
+++ b/flatpak/org.gnome.Polari.json
@@ -77,6 +77,10 @@
                     "url": "https://www.github.com/TelepathyIM/telepathy-mission-control.git";,
                     "tag": "telepathy-mission-control-5.16.4",
                     "commit": "74d553d4125224f0a95c9d2843d38861b42eae9f"
+                },
+                {
+                    "type": "patch",
+                    "path": "tp-mc-python3.patch"
                 }
             ],
             "cleanup": [
@@ -93,6 +97,10 @@
                     "url": "https://www.github.com/TelepathyIM/telepathy-idle.git";,
                     "tag": "telepathy-idle-0.2.0",
                     "commit": "22371837e080c41343600ca773fd987e5310baf2"
+                },
+                {
+                    "type": "patch",
+                    "path": "tp-idle-python3.patch"
                 }
             ],
             "cleanup": [
@@ -112,6 +120,10 @@
                 {
                     "type": "patch",
                     "path": "tpl-override-basedir.patch"
+                },
+                {
+                    "type": "patch",
+                    "path": "tpl-python3.patch"
                 }
             ],
             "cleanup": [
diff --git a/flatpak/tp-idle-python3.patch b/flatpak/tp-idle-python3.patch
new file mode 100644
index 0000000..0a28e6a
--- /dev/null
+++ b/flatpak/tp-idle-python3.patch
@@ -0,0 +1,142 @@
+From 90b75ca8d5bbf8bf279f832d5801df2eb60b6ac9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner gnome org>
+Date: Mon, 15 Jul 2019 18:51:30 +0200
+Subject: [PATCH] tools: Port to python3
+
+---
+ configure.ac                 |  2 +-
+ tools/glib-ginterface-gen.py | 26 ++++++++++++--------------
+ tools/libglibcodegen.py      |  5 ++---
+ 3 files changed, 15 insertions(+), 18 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 02a5966..dfe9a88 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -105,7 +105,7 @@ AC_CHECK_PROGS([XSLTPROC], [xsltproc])
+ AS_IF([test -z "$XSLTPROC"],
+   [AC_MSG_ERROR([xsltproc (from the libxslt source package) is required])])
+ 
+-AM_PATH_PYTHON([2.3])
++AM_PATH_PYTHON([3.6])
+ 
+ dnl check for a version of python that can run the twisted tests
+ AC_MSG_CHECKING([for Python with Twisted and IRC protocol support])
+diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py
+index 8fea5df..2ef7b43 100644
+--- a/tools/glib-ginterface-gen.py
++++ b/tools/glib-ginterface-gen.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ # glib-ginterface-gen.py: service-side interface generator
+ #
+@@ -27,7 +27,7 @@ import os.path
+ import xml.dom.minidom
+ 
+ from libtpcodegen import file_set_contents
+-from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
++from libglibcodegen import Signature, type_to_gtype, \
+         NS_TP, dbus_gutils_wincaps_to_uscore
+ 
+ 
+@@ -85,18 +85,18 @@ class Generator(object):
+         self.allow_havoc = allow_havoc
+ 
+     def h(self, s):
+-        if isinstance(s, unicode):
+-            s = s.encode('utf-8')
++        if isinstance(s, bytes):
++            s = str(s, 'ascii')
+         self.__header.append(s)
+ 
+     def b(self, s):
+-        if isinstance(s, unicode):
+-            s = s.encode('utf-8')
++        if isinstance(s, bytes):
++            s = str(s, 'ascii')
+         self.__body.append(s)
+ 
+     def d(self, s):
+-        if isinstance(s, unicode):
+-            s = s.encode('utf-8')
++        if isinstance(s, bytes):
++            s = str(s, 'ascii')
+         self.__docs.append(s)
+ 
+     def do_node(self, node):
+@@ -733,13 +733,14 @@ class Generator(object):
+ 
+     def __call__(self):
+         nodes = self.dom.getElementsByTagName('node')
+-        nodes.sort(cmp_by_name)
++        nodes.sort(key=lambda node : node.getAttributeNode('name').nodeValue)
+ 
+         self.h('#include <glib-object.h>')
+         self.h('#include <dbus/dbus-glib.h>')
+ 
+         if self.have_properties(nodes):
+             self.h('#include <telepathy-glib/telepathy-glib.h>')
++        self.h('')
+ 
+         self.h('')
+         self.h('G_BEGIN_DECLS')
+@@ -747,9 +748,6 @@ class Generator(object):
+ 
+         self.b('#include "%s.h"' % self.basename)
+         self.b('')
+-        for header in self.headers:
+-            self.b('#include %s' % header)
+-        self.b('')
+ 
+         for node in nodes:
+             self.do_node(node)
+@@ -768,7 +766,7 @@ class Generator(object):
+         file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
+ 
+ def cmdline_error():
+-    print """\
++    print('''
+ usage:
+     gen-ginterface [OPTIONS] xmlfile Prefix_
+ options:
+@@ -788,7 +786,7 @@ options:
+             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/libglibcodegen.py b/tools/libglibcodegen.py
+index 6a9d214..5789609 100644
+--- a/tools/libglibcodegen.py
++++ b/tools/libglibcodegen.py
+@@ -23,7 +23,6 @@ please make any changes there.
+ 
+ from libtpcodegen import NS_TP, \
+                          Signature, \
+-                         cmp_by_name, \
+                          escape_as_identifier, \
+                          get_by_path, \
+                          get_descendant_text, \
+@@ -154,7 +153,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 +168,4 @@ 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)
+-- 
+2.21.0
+
diff --git a/flatpak/tp-mc-python3.patch b/flatpak/tp-mc-python3.patch
new file mode 100644
index 0000000..67d2b0a
--- /dev/null
+++ b/flatpak/tp-mc-python3.patch
@@ -0,0 +1,324 @@
+From ed91bdf3d8220ef84ced881829781952339e3487 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner gnome org>
+Date: Mon, 15 Jul 2019 17:50:38 +0200
+Subject: [PATCH] tools: Move to python3
+
+Python 2 is barely alive, time to port build tools over to python 3.
+---
+ configure.ac                        |  2 +-
+ tools/glib-blocking-client-gen.py   |  6 +++---
+ tools/glib-client-gen.py            | 18 +++++++++---------
+ tools/glib-client-marshaller-gen.py | 22 +++++++++++-----------
+ tools/glib-ginterface-gen.py        | 22 +++++++++++-----------
+ tools/glib-gtypes-generator.py      |  8 ++++----
+ tools/glib-signals-marshal-gen.py   |  6 +++---
+ tools/libglibcodegen.py             |  5 ++---
+ tools/libtpcodegen.py               |  5 ++++-
+ 9 files changed, 48 insertions(+), 46 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index cf9d290f..f405557b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -84,7 +84,7 @@ if test -z "$XSLTPROC"; then
+     AC_MSG_ERROR([xsltproc (from the libxslt source package) is required])
+ fi
+ 
+-AM_PATH_PYTHON([2.6])
++AM_PATH_PYTHON([3.6])
+ AC_MSG_CHECKING([for enough Python for the tests])
+ mc_want_twisted_tests=no
+ if $PYTHON -c "import twisted.internet.reactor, dbus.mainloop.glib"\
+diff --git a/tools/glib-blocking-client-gen.py b/tools/glib-blocking-client-gen.py
+index c20dcd4a..e38825c1 100644
+--- a/tools/glib-blocking-client-gen.py
++++ b/tools/glib-blocking-client-gen.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ # glib-client-gen.py: "I Can't Believe It's Not dbus-binding-tool"
+ #
+@@ -27,7 +27,7 @@ import os.path
+ import xml.dom.minidom
+ from getopt import gnu_getopt
+ 
+-from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
++from libglibcodegen import Signature, type_to_gtype, \
+         camelcase_to_lower, get_docstring
+ 
+ 
+@@ -945,7 +945,7 @@ class Generator(object):
+         self.b('')
+ 
+         nodes = self.dom.getElementsByTagName('node')
+-        nodes.sort(cmp_by_name)
++        nodes.sort(key=lambda node: node.getAttributeNode('name').nodeValue)
+ 
+         for node in nodes:
+             self.do_interface(node)
+diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
+index f8465a62..6e164b33 100644
+--- a/tools/glib-client-gen.py
++++ b/tools/glib-client-gen.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ # glib-client-gen.py: "I Can't Believe It's Not dbus-binding-tool"
+ #
+@@ -28,7 +28,7 @@ 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, \
++from libglibcodegen import Signature, type_to_gtype, \
+         get_docstring, xml_escape, get_deprecated
+ 
+ 
+@@ -74,18 +74,18 @@ class Generator(object):
+         self.guard = opts.get('--guard', None)
+ 
+     def h(self, s):
+-        if isinstance(s, unicode):
+-            s = s.encode('utf-8')
++        if isinstance(s, bytes):
++            s = str(s, 'ascii')
+         self.__header.append(s)
+ 
+     def b(self, s):
+-        if isinstance(s, unicode):
+-            s = s.encode('utf-8')
++        if isinstance(s, bytes):
++            s = str(s, 'ascii')
+         self.__body.append(s)
+ 
+     def d(self, s):
+-        if isinstance(s, unicode):
+-            s = s.encode('utf-8')
++        if isinstance(s, bytes):
++            s = str(s, 'ascii')
+         self.__docs.append(s)
+ 
+     def get_iface_quark(self):
+@@ -1191,7 +1191,7 @@ class Generator(object):
+         self.b('')
+ 
+         nodes = self.dom.getElementsByTagName('node')
+-        nodes.sort(cmp_by_name)
++        nodes.sort(key=lambda node: node.getAttributeNode('name').nodeValue)
+ 
+         for node in nodes:
+             self.do_interface(node)
+diff --git a/tools/glib-client-marshaller-gen.py b/tools/glib-client-marshaller-gen.py
+index cb27d638..0ac81932 100644
+--- a/tools/glib-client-marshaller-gen.py
++++ b/tools/glib-client-marshaller-gen.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ import sys
+ import xml.dom.minidom
+@@ -31,23 +31,23 @@ class Generator(object):
+         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()
++        sorted(all)
+         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-ginterface-gen.py b/tools/glib-ginterface-gen.py
+index 6fec0d3c..2421e721 100644
+--- a/tools/glib-ginterface-gen.py
++++ b/tools/glib-ginterface-gen.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ # glib-ginterface-gen.py: service-side interface generator
+ #
+@@ -27,7 +27,7 @@ import os.path
+ import xml.dom.minidom
+ 
+ from libtpcodegen import file_set_contents
+-from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
++from libglibcodegen import Signature, type_to_gtype, \
+         NS_TP, dbus_gutils_wincaps_to_uscore
+ 
+ 
+@@ -85,18 +85,18 @@ class Generator(object):
+         self.allow_havoc = allow_havoc
+ 
+     def h(self, s):
+-        if isinstance(s, unicode):
+-            s = s.encode('utf-8')
++        if isinstance(s, bytes):
++            s = str(s, 'ascii')
+         self.__header.append(s)
+ 
+     def b(self, s):
+-        if isinstance(s, unicode):
+-            s = s.encode('utf-8')
++        if isinstance(s, bytes):
++            s = str(s, 'ascii')
+         self.__body.append(s)
+ 
+     def d(self, s):
+-        if isinstance(s, unicode):
+-            s = s.encode('utf-8')
++        if isinstance(s, bytes):
++            s = str(s, 'ascii')
+         self.__docs.append(s)
+ 
+     def do_node(self, node):
+@@ -733,7 +733,7 @@ class Generator(object):
+ 
+     def __call__(self):
+         nodes = self.dom.getElementsByTagName('node')
+-        nodes.sort(cmp_by_name)
++        nodes.sort(key=lambda node : node.getAttributeNode('name').nodeValue)
+ 
+         self.h('#include <glib-object.h>')
+         self.h('#include <dbus/dbus-glib.h>')
+@@ -766,7 +766,7 @@ class Generator(object):
+         file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
+ 
+ def cmdline_error():
+-    print """\
++    print('''
+ usage:
+     gen-ginterface [OPTIONS] xmlfile Prefix_
+ options:
+@@ -786,7 +786,7 @@ options:
+             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 21dfc6aa..27faa1a2 100644
+--- a/tools/glib-gtypes-generator.py
++++ b/tools/glib-gtypes-generator.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ # Generate GLib GInterfaces from the Telepathy specification.
+ # The master copy of this program is in the telepathy-glib repository -
+@@ -68,13 +68,13 @@ class GTypesGenerator(object):
+         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')
+diff --git a/tools/glib-signals-marshal-gen.py b/tools/glib-signals-marshal-gen.py
+index 0d02c134..6746f0e4 100644
+--- a/tools/glib-signals-marshal-gen.py
++++ b/tools/glib-signals-marshal-gen.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ import sys
+ import xml.dom.minidom
+@@ -42,11 +42,11 @@ class Generator(object):
+             self.do_signal(signal)
+ 
+         all = self.marshallers.keys()
+-        all.sort()
++        sorted(all)
+         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 6a9d2148..57896099 100644
+--- a/tools/libglibcodegen.py
++++ b/tools/libglibcodegen.py
+@@ -23,7 +23,6 @@ please make any changes there.
+ 
+ from libtpcodegen import NS_TP, \
+                          Signature, \
+-                         cmp_by_name, \
+                          escape_as_identifier, \
+                          get_by_path, \
+                          get_descendant_text, \
+@@ -154,7 +153,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 +168,4 @@ 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)
+diff --git a/tools/libtpcodegen.py b/tools/libtpcodegen.py
+index 7e9eb9a5..8e052c28 100644
+--- a/tools/libtpcodegen.py
++++ b/tools/libtpcodegen.py
+@@ -167,7 +167,10 @@ class _SignatureIter:
+     def __init__(self, string):
+         self.remaining = string
+ 
+-    def next(self):
++    def __iter__(self):
++        self
++
++    def __next__(self):
+         if self.remaining == '':
+             raise StopIteration
+ 
+-- 
+2.21.0
+
diff --git a/flatpak/tpl-python3.patch b/flatpak/tpl-python3.patch
new file mode 100644
index 0000000..f4233fd
--- /dev/null
+++ b/flatpak/tpl-python3.patch
@@ -0,0 +1,799 @@
+From 2040d911760bae07b57adaf1b6bb06b361224ab9 Mon Sep 17 00:00:00 2001
+From: Guillaume Desmottes <guillaume desmottes collabora co uk>
+Date: Mon, 23 Sep 2013 16:05:45 +0200
+Subject: [PATCH] sync tools/ with tp-glib master
+
+Needed to stop using deprecated API in generated code.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=69797
+---
+ tools/c-constants-gen.py            | 12 +++---
+ tools/glib-client-gen.py            | 22 +++++-----
+ 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        | 30 +++++---------
+ tools/glib-gtypes-generator.py      | 14 +++----
+ tools/glib-interfaces-gen.py        | 14 +++----
+ tools/gobject-foo.py                |  2 +-
+ tools/lcov.am                       |  3 +-
+ tools/libglibcodegen.py             |  4 +-
+ tools/libtpcodegen.py               | 22 +++++++++-
+ tools/make-release-mail.py          |  4 +-
+ tools/make-version-script.py        | 32 +++++++--------
+ tools/telepathy.am                  | 29 +++++++++-----
+ tools/with-session-bus.sh           |  6 +++
+ tools/xincludator.py                | 13 ++++--
+ 17 files changed, 165 insertions(+), 138 deletions(-)
+
+diff --git a/tools/c-constants-gen.py b/tools/c-constants-gen.py
+index 0c7216a..d0b1fbb 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 @@ class Generator(object):
+         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 @@ class Generator(object):
+         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 293aae5..a9df23a 100644
+--- a/tools/glib-client-gen.py
++++ b/tools/glib-client-gen.py
+@@ -27,8 +27,8 @@ import os.path
+ 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, \
++from libtpcodegen import file_set_contents, key_by_name, u
++from libglibcodegen import Signature, type_to_gtype, \
+         get_docstring, xml_escape, get_deprecated
+ 
+ 
+@@ -74,18 +74,12 @@ class Generator(object):
+         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):
+@@ -783,9 +777,11 @@ class Generator(object):
+         self.b('  g_return_val_if_fail (callback != NULL || '
+                'weak_object == NULL, NULL);')
+         self.b('')
++        self.b('  G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
+         self.b('  iface = tp_proxy_borrow_interface_by_id (')
+         self.b('      (TpProxy *) proxy,')
+         self.b('      interface, &error);')
++        self.b('  G_GNUC_END_IGNORE_DEPRECATIONS')
+         self.b('')
+         self.b('  if (iface == NULL)')
+         self.b('    {')
+@@ -1064,8 +1060,10 @@ class Generator(object):
+         self.b('  g_return_val_if_fail (%s (proxy), FALSE);'
+                % self.proxy_assert)
+         self.b('')
++        self.b('  G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
+         self.b('  iface = tp_proxy_borrow_interface_by_id')
+         self.b('       ((TpProxy *) proxy, interface, error);')
++        self.b('  G_GNUC_END_IGNORE_DEPRECATIONS')
+         self.b('')
+         self.b('  if (iface == NULL)')
+         self.b('    return FALSE;')
+@@ -1187,7 +1185,7 @@ class Generator(object):
+         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)
+@@ -1240,9 +1238,9 @@ class Generator(object):
+             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 5b48b13..e6e911f 100644
+--- a/tools/glib-client-marshaller-gen.py
++++ b/tools/glib-client-marshaller-gen.py
+@@ -31,23 +31,23 @@ class Generator(object):
+         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 74ae3e3..99d66b5 100644
+--- a/tools/glib-errors-check-gen.py
++++ b/tools/glib-errors-check-gen.py
+@@ -12,13 +12,13 @@ class Generator(object):
+ 
+     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 @@ class Generator(object):
+             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 ffac1e1..0e18f30 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 @@ class Generator(object):
+         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 @@ class Generator(object):
+         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 5c85a72..299a4c4 100644
+--- a/tools/glib-ginterface-gen.py
++++ b/tools/glib-ginterface-gen.py
+@@ -26,8 +26,8 @@ import sys
+ 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 @@ class Generator(object):
+         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,13 +727,14 @@ class Generator(object):
+ 
+     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>')
+ 
+-        if self.have_properties(nodes):
+-            self.h('#include <telepathy-glib/dbus-properties-mixin.h>')
++        for header in self.headers:
++            self.h('#include %s' % header)
++        self.h('')
+ 
+         self.h('')
+         self.h('G_BEGIN_DECLS')
+@@ -747,9 +742,6 @@ class Generator(object):
+ 
+         self.b('#include "%s.h"' % self.basename)
+         self.b('')
+-        for header in self.headers:
+-            self.b('#include %s' % header)
+-        self.b('')
+ 
+         for node in nodes:
+             self.do_node(node)
+@@ -763,12 +755,12 @@ class Generator(object):
+ 
+         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:
+@@ -788,7 +780,7 @@ options:
+             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 9fada94..2eeb976 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 @@ class GTypesGenerator(object):
+         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 @@ class GTypesGenerator(object):
+             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 7dc3801..4ce4767 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 @@ class Generator(object):
+         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 6396196..109c4f4 100644
+--- a/tools/gobject-foo.py
++++ b/tools/gobject-foo.py
+@@ -87,4 +87,4 @@ if __name__ == '__main__':
+ 
+     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/lcov.am b/tools/lcov.am
+index 7384f1b..d2d282a 100644
+--- a/tools/lcov.am
++++ b/tools/lcov.am
+@@ -7,7 +7,8 @@ lcov-report:
+       lcov --directory @top_srcdir@ --output-file @top_builddir@/lcov.info \
+               --remove @top_builddir@/lcov.info.tmp telepathy-glib-scan.c
+       rm @top_builddir@/lcov.info.tmp
+-      $(mkdir_p) @top_builddir@/lcov.html
++      $(MKDIR_P) @top_builddir@/lcov.html
++      echo "Coming soon!" > @top_builddir@/lcov.html/index.html
+       git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\
+       genhtml --title "@PACKAGE_STRING@ $$git_commit" \
+               --output-directory @top_builddir@/lcov.html lcov.info
+diff --git a/tools/libglibcodegen.py b/tools/libglibcodegen.py
+index 6a9d214..6cd1a62 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,4 @@ 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)
+diff --git a/tools/libtpcodegen.py b/tools/libtpcodegen.py
+index 7e9eb9a..99de663 100644
+--- a/tools/libtpcodegen.py
++++ b/tools/libtpcodegen.py
+@@ -21,6 +21,7 @@ please make any changes there.
+ # 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 @@ NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0";
+ 
+ _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 @@ class _SignatureIter:
+         self.remaining = string
+ 
+     def next(self):
++        return self.__next__()
++
++    def __next__(self):
+         if self.remaining == '':
+             raise StopIteration
+ 
+diff --git a/tools/make-release-mail.py b/tools/make-release-mail.py
+index 786b6dc..b03ebd2 100644
+--- a/tools/make-release-mail.py
++++ b/tools/make-release-mail.py
+@@ -62,8 +62,8 @@ def main(package, version, news_path):
+     print """
+ %(release_name)s
+ 
+-tarball: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.bz2
+-signature: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.bz2.asc
++tarball: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.gz
++signature: %(base_url)s/%(package)s/%(package)s-%(version)s.tar.gz.asc
+ git: %(git_url)s/%(package)s
+ 
+ %(details)s""".strip().rstrip() % {
+diff --git a/tools/make-version-script.py b/tools/make-version-script.py
+index 0d30aa3..4ced849 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/telepathy.am b/tools/telepathy.am
+index 5e78dfd..20ff0be 100644
+--- a/tools/telepathy.am
++++ b/tools/telepathy.am
+@@ -42,14 +42,21 @@ else
+       @exit 2;
+ endif
+ 
+-%.tar.bz2.asc: %.tar.bz2
++%.tar.gz.asc: %.tar.gz
+       $(AM_V_GEN)gpg --detach-sign --armor $@
+ 
+-@PACKAGE@-@VERSION@.tar.bz2: _is-release-check check distcheck
++@PACKAGE@-@VERSION  tar gz:
++      $(MAKE) _is-release-check
++      $(MAKE) check
++      $(MAKE) distcheck
+ 
+-maintainer-prepare-release: _is-release-check all distcheck release-mail
++maintainer-prepare-release:
++      $(MAKE) _is-release-check
++      $(MAKE) all
++      $(MAKE) distcheck
++      $(MAKE) release-mail
+       git tag -s @PACKAGE@-@VERSION@ -m @PACKAGE@' '@VERSION@
+-      gpg --detach-sign --armor @PACKAGE@-@VERSION@.tar.bz2
++      gpg --detach-sign --armor @PACKAGE@-@VERSION  tar gz
+ 
+ release-mail: NEWS
+       $(AM_V_GEN)(python $(top_srcdir)/tools/make-release-mail.py \
+@@ -59,15 +66,17 @@ release-mail: NEWS
+ maintainer-upload-release: _maintainer-upload-release
+ 
+ _maintainer-upload-release-check: _is-release-check
+-      test -f @PACKAGE@-@VERSION@.tar.bz2
+-      test -f @PACKAGE@-@VERSION  tar bz2 asc
+-      gpg --verify @PACKAGE@-@VERSION  tar bz2 asc
++      test -f @PACKAGE@-@VERSION  tar gz
++      test -f @PACKAGE@-@VERSION  tar gz asc
++      gpg --verify @PACKAGE@-@VERSION  tar gz asc
+ 
+ _maintainer-upload-release: _maintainer-upload-release-check
+-      rsync -vzP @PACKAGE@-@VERSION@.tar.bz2 
telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION@.tar.bz2
+-      rsync -vzP @PACKAGE@-@VERSION  tar bz2 asc 
telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION  tar bz2 
asc
++      rsync -vzP @PACKAGE@-@VERSION  tar gz 
telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION  tar gz
++      rsync -vzP @PACKAGE@-@VERSION  tar gz asc 
telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@VERSION  tar gz asc
+ 
+-maintainer-make-release: maintainer-prepare-release maintainer-upload-release
++maintainer-make-release:
++      $(MAKE) maintainer-prepare-release
++      $(MAKE) maintainer-upload-release
+       @echo "Now:"
+       @echo " • bump the nano-version;"
+       @echo " • push the branch and tags upstream; and"
+diff --git a/tools/with-session-bus.sh b/tools/with-session-bus.sh
+index b3038cd..0afa593 100755
+--- a/tools/with-session-bus.sh
++++ b/tools/with-session-bus.sh
+@@ -77,6 +77,12 @@ if [ -n "$VERBOSE_TESTS" ]; then
+ fi
+ 
+ e=0
++
++# These might be non-null when run from e.g. gnome-terminal 3.8, which uses
++# an activatable service for its windows; we don't want to inherit them either
++unset DBUS_STARTER_ADDRESS
++unset DBUS_STARTER_BUS_TYPE
++
+ DBUS_SESSION_BUS_ADDRESS="`cat $me-$$.address`"
+ export DBUS_SESSION_BUS_ADDRESS
+ DBUS_SESSION_BUS_PID="`cat $me-$$.pid`"
+diff --git a/tools/xincludator.py b/tools/xincludator.py
+index 12b35f0..aaf015e 100644
+--- a/tools/xincludator.py
++++ b/tools/xincludator.py
+@@ -1,17 +1,19 @@
+ #!/usr/bin/python3
+ 
++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 @@ if __name__ == '__main__':
+     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')
+-- 
+2.21.0
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]