aboutsummaryrefslogtreecommitdiffstats
path: root/tools/glib-ginterface-gen.py
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-01-04 18:28:17 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-01-04 18:29:06 +0800
commit403ebcfcc6bcf95b1ef914de48ac5509c284b150 (patch)
tree347c425d2247a6125fb0bdff8acc9dbca804be0b /tools/glib-ginterface-gen.py
parent0aa79adae47a074f0fd59762eec0c133ca48ae2a (diff)
downloadgsoc2013-empathy-403ebcfcc6bcf95b1ef914de48ac5509c284b150.tar
gsoc2013-empathy-403ebcfcc6bcf95b1ef914de48ac5509c284b150.tar.gz
gsoc2013-empathy-403ebcfcc6bcf95b1ef914de48ac5509c284b150.tar.bz2
gsoc2013-empathy-403ebcfcc6bcf95b1ef914de48ac5509c284b150.tar.lz
gsoc2013-empathy-403ebcfcc6bcf95b1ef914de48ac5509c284b150.tar.xz
gsoc2013-empathy-403ebcfcc6bcf95b1ef914de48ac5509c284b150.tar.zst
gsoc2013-empathy-403ebcfcc6bcf95b1ef914de48ac5509c284b150.zip
sync tools/ with telepathy-glib
This should allow Empathy to be build with Python 3. https://bugzilla.gnome.org/show_bug.cgi?id=687616
Diffstat (limited to 'tools/glib-ginterface-gen.py')
-rw-r--r--tools/glib-ginterface-gen.py22
1 files changed, 8 insertions, 14 deletions
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 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,7 +727,7 @@ 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>')
@@ -761,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:
@@ -786,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)