aboutsummaryrefslogtreecommitdiffstats
path: root/tools/glib-client-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-client-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-client-gen.py')
-rw-r--r--tools/glib-client-gen.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
index f8465a62b..e68e1a575 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):
@@ -1191,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)
@@ -1244,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]