Added
Link Here
|
1 |
--- tools/glib-ginterface-gen.py.orig 2020-09-23 16:17:54 UTC |
2 |
+++ tools/glib-ginterface-gen.py |
3 |
@@ -26,8 +26,8 @@ import sys |
4 |
import os.path |
5 |
import xml.dom.minidom |
6 |
|
7 |
-from libtpcodegen import file_set_contents |
8 |
-from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \ |
9 |
+from libtpcodegen import file_set_contents, key_by_name, u |
10 |
+from libglibcodegen import Signature, type_to_gtype, \ |
11 |
NS_TP, dbus_gutils_wincaps_to_uscore |
12 |
|
13 |
|
14 |
@@ -85,18 +85,12 @@ class Generator(object): |
15 |
self.allow_havoc = allow_havoc |
16 |
|
17 |
def h(self, s): |
18 |
- if isinstance(s, unicode): |
19 |
- s = s.encode('utf-8') |
20 |
self.__header.append(s) |
21 |
|
22 |
def b(self, s): |
23 |
- if isinstance(s, unicode): |
24 |
- s = s.encode('utf-8') |
25 |
self.__body.append(s) |
26 |
|
27 |
def d(self, s): |
28 |
- if isinstance(s, unicode): |
29 |
- s = s.encode('utf-8') |
30 |
self.__docs.append(s) |
31 |
|
32 |
def do_node(self, node): |
33 |
@@ -733,7 +727,7 @@ class Generator(object): |
34 |
|
35 |
def __call__(self): |
36 |
nodes = self.dom.getElementsByTagName('node') |
37 |
- nodes.sort(cmp_by_name) |
38 |
+ nodes.sort(key=key_by_name) |
39 |
|
40 |
self.h('#include <glib-object.h>') |
41 |
self.h('#include <dbus/dbus-glib.h>') |
42 |
@@ -763,12 +757,12 @@ class Generator(object): |
43 |
|
44 |
self.h('') |
45 |
self.b('') |
46 |
- file_set_contents(self.basename + '.h', '\n'.join(self.__header)) |
47 |
- file_set_contents(self.basename + '.c', '\n'.join(self.__body)) |
48 |
- file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs)) |
49 |
+ file_set_contents(self.basename + '.h', u('\n').join(self.__header).encode('utf-8')) |
50 |
+ file_set_contents(self.basename + '.c', u('\n').join(self.__body).encode('utf-8')) |
51 |
+ file_set_contents(self.basename + '-gtk-doc.h', u('\n').join(self.__docs).encode('utf-8')) |
52 |
|
53 |
def cmdline_error(): |
54 |
- print """\ |
55 |
+ print("""\ |
56 |
usage: |
57 |
gen-ginterface [OPTIONS] xmlfile Prefix_ |
58 |
options: |
59 |
@@ -788,7 +782,7 @@ options: |
60 |
void symbol (DBusGMethodInvocation *context) |
61 |
and return some sort of "not implemented" error via |
62 |
dbus_g_method_return_error (context, ...) |
63 |
-""" |
64 |
+""") |
65 |
sys.exit(1) |
66 |
|
67 |
|