View | Details | Raw Unified | Return to bug 249549
Collapse All | Expand All

(-)net-im/telepathy-logger/Makefile (-1 / +1 lines)
Lines 18-24 LIB_DEPENDS= libdbus-glib-1.so:devel/dbus-glib \ Link Here
18
		libtelepathy-glib.so:net-im/telepathy-glib
18
		libtelepathy-glib.so:net-im/telepathy-glib
19
19
20
USES=		gettext-tools gmake gnome libtool pathfix pkgconfig \
20
USES=		gettext-tools gmake gnome libtool pathfix pkgconfig \
21
		python:2.7,build sqlite tar:bzip2
21
		python:build sqlite tar:bzip2
22
GNU_CONFIGURE=	yes
22
GNU_CONFIGURE=	yes
23
USE_LDCONFIG=	yes
23
USE_LDCONFIG=	yes
24
USE_GNOME=	glib20 intltool libxml2 \
24
USE_GNOME=	glib20 intltool libxml2 \
(-)net-im/telepathy-logger/files/patch-configure (-3 / +3 lines)
Lines 1-6 Link Here
1
--- configure.orig	2010-08-18 14:48:05.000000000 +0200
1
--- configure.orig	2015-04-30 11:32:10 UTC
2
+++ configure	2010-08-18 14:49:13.000000000 +0200
2
+++ configure
3
@@ -13281,8 +13281,8 @@
3
@@ -14348,8 +14348,8 @@ install-data-am: install-gsettings-schemas
4
 .SECONDARY: $(gsettings_SCHEMAS)
4
 .SECONDARY: $(gsettings_SCHEMAS)
5
 
5
 
6
 gsettings__base_list = \
6
 gsettings__base_list = \
(-)net-im/telepathy-logger/files/patch-tools_c-constants-gen.py (+39 lines)
Added Link Here
1
--- tools/c-constants-gen.py.orig	2020-09-23 16:17:54 UTC
2
+++ tools/c-constants-gen.py
3
@@ -3,7 +3,7 @@
4
 from sys import argv, stdout, stderr
5
 import xml.dom.minidom
6
 
7
-from libtpcodegen import file_set_contents
8
+from libtpcodegen import file_set_contents, u
9
 from libglibcodegen import NS_TP, get_docstring, \
10
         get_descendant_text, get_by_path
11
 
12
@@ -12,7 +12,7 @@ class Generator(object):
13
         self.prefix = prefix + '_'
14
         self.spec = get_by_path(dom, "spec")[0]
15
 
16
-	self.output_base = output_base
17
+        self.output_base = output_base
18
         self.__header = []
19
         self.__docs = []
20
 
21
@@ -21,14 +21,14 @@ class Generator(object):
22
         self.do_body()
23
         self.do_footer()
24
 
25
-        file_set_contents(self.output_base + '.h', ''.join(self.__header))
26
-        file_set_contents(self.output_base + '-gtk-doc.h', ''.join(self.__docs))
27
+        file_set_contents(self.output_base + '.h', u('').join(self.__header).encode('utf-8'))
28
+        file_set_contents(self.output_base + '-gtk-doc.h', u('').join(self.__docs).encode('utf-8'))
29
 
30
     def write(self, code):
31
-        self.__header.append(code.encode('utf-8'))
32
+        self.__header.append(code)
33
 
34
     def d(self, code):
35
-        self.__docs.append(code.encode('utf-8'))
36
+        self.__docs.append(code)
37
 
38
     # Header
39
     def do_header(self):
(-)net-im/telepathy-logger/files/patch-tools_glib-client-gen.py (+54 lines)
Added Link Here
1
--- tools/glib-client-gen.py.orig	2020-09-23 16:17:54 UTC
2
+++ tools/glib-client-gen.py
3
@@ -27,8 +27,8 @@ import os.path
4
 import xml.dom.minidom
5
 from getopt import gnu_getopt
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
         get_docstring, xml_escape, get_deprecated
12
 
13
 
14
@@ -74,18 +74,12 @@ class Generator(object):
15
         self.guard = opts.get('--guard', None)
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 get_iface_quark(self):
33
@@ -1187,7 +1181,7 @@ class Generator(object):
34
         self.b('')
35
 
36
         nodes = self.dom.getElementsByTagName('node')
37
-        nodes.sort(cmp_by_name)
38
+        nodes.sort(key=key_by_name)
39
 
40
         for node in nodes:
41
             self.do_interface(node)
42
@@ -1240,9 +1234,9 @@ class Generator(object):
43
             self.h('#endif /* defined (%s) */' % self.guard)
44
             self.h('')
45
 
46
-        file_set_contents(self.basename + '.h', '\n'.join(self.__header))
47
-        file_set_contents(self.basename + '-body.h', '\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 + '-body.h', 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 types_to_gtypes(types):
54
     return [type_to_gtype(t)[1] for t in types]
(-)net-im/telepathy-logger/files/patch-tools_glib-client-marshaller-gen.py (+36 lines)
Added Link Here
1
--- tools/glib-client-marshaller-gen.py.orig	2020-09-23 16:17:54 UTC
2
+++ tools/glib-client-marshaller-gen.py
3
@@ -31,23 +31,23 @@ class Generator(object):
4
         for signal in signals:
5
             self.do_signal(signal)
6
 
7
-        print 'void'
8
-        print '%s_register_dbus_glib_marshallers (void)' % self.prefix
9
-        print '{'
10
+        print('void')
11
+        print('%s_register_dbus_glib_marshallers (void)' % self.prefix)
12
+        print('{')
13
 
14
-        all = self.marshallers.keys()
15
+        all = list(self.marshallers.keys())
16
         all.sort()
17
         for marshaller in all:
18
             rhs = self.marshallers[marshaller]
19
 
20
-            print '  dbus_g_object_register_marshaller ('
21
-            print '      g_cclosure_marshal_generic,'
22
-            print '      G_TYPE_NONE,       /* return */'
23
+            print('  dbus_g_object_register_marshaller (')
24
+            print('      g_cclosure_marshal_generic,')
25
+            print('      G_TYPE_NONE,       /* return */')
26
             for type in rhs:
27
-                print '      G_TYPE_%s,' % type.replace('VOID', 'NONE')
28
-            print '      G_TYPE_INVALID);'
29
+                print('      G_TYPE_%s,' % type.replace('VOID', 'NONE'))
30
+            print('      G_TYPE_INVALID);')
31
 
32
-        print '}'
33
+        print('}')
34
 
35
 
36
 def types_to_gtypes(types):
(-)net-im/telepathy-logger/files/patch-tools_glib-ginterface-gen.py (+67 lines)
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
 
(-)net-im/telepathy-logger/files/patch-tools_glib-gtypes-generator.py (+41 lines)
Added Link Here
1
--- tools/glib-gtypes-generator.py.orig	2020-09-23 16:17:54 UTC
2
+++ tools/glib-gtypes-generator.py
3
@@ -23,7 +23,7 @@
4
 import sys
5
 import xml.dom.minidom
6
 
7
-from libtpcodegen import file_set_contents
8
+from libtpcodegen import file_set_contents, u
9
 from libglibcodegen import escape_as_identifier, \
10
                            get_docstring, \
11
                            NS_TP, \
12
@@ -68,13 +68,13 @@ class GTypesGenerator(object):
13
         self.need_other_arrays = {}
14
 
15
     def h(self, code):
16
-        self.header.append(code.encode("utf-8"))
17
+        self.header.append(code)
18
 
19
     def c(self, code):
20
-        self.body.append(code.encode("utf-8"))
21
+        self.body.append(code)
22
 
23
     def d(self, code):
24
-        self.docs.append(code.encode('utf-8'))
25
+        self.docs.append(code)
26
 
27
     def do_mapping_header(self, mapping):
28
         members = mapping.getElementsByTagNameNS(NS_TP, 'member')
29
@@ -292,9 +292,9 @@ class GTypesGenerator(object):
30
             self.c('  return t;\n')
31
             self.c('}\n\n')
32
 
33
-        file_set_contents(self.output + '.h', ''.join(self.header))
34
-        file_set_contents(self.output + '-body.h', ''.join(self.body))
35
-        file_set_contents(self.output + '-gtk-doc.h', ''.join(self.docs))
36
+        file_set_contents(self.output + '.h', u('').join(self.header).encode('utf-8'))
37
+        file_set_contents(self.output + '-body.h', u('').join(self.body).encode('utf-8'))
38
+        file_set_contents(self.output + '-gtk-doc.h', u('').join(self.docs).encode('utf-8'))
39
 
40
 if __name__ == '__main__':
41
     argv = sys.argv[1:]
(-)net-im/telepathy-logger/files/patch-tools_glib-interfaces-gen.py (+40 lines)
Added Link Here
1
--- tools/glib-interfaces-gen.py.orig	2020-09-23 16:17:54 UTC
2
+++ tools/glib-interfaces-gen.py
3
@@ -3,7 +3,7 @@
4
 from sys import argv, stdout, stderr
5
 import xml.dom.minidom
6
 
7
-from libtpcodegen import file_set_contents
8
+from libtpcodegen import file_set_contents, u
9
 from libglibcodegen import NS_TP, get_docstring, \
10
         get_descendant_text, get_by_path
11
 
12
@@ -24,22 +24,22 @@ class Generator(object):
13
         self.spec = get_by_path(dom, "spec")[0]
14
 
15
     def h(self, code):
16
-        self.decls.append(code.encode('utf-8'))
17
+        self.decls.append(code)
18
 
19
     def c(self, code):
20
-        self.impls.append(code.encode('utf-8'))
21
+        self.impls.append(code)
22
 
23
     def d(self, code):
24
-        self.docs.append(code.encode('utf-8'))
25
+        self.docs.append(code)
26
 
27
     def __call__(self):
28
         for f in self.h, self.c:
29
             self.do_header(f)
30
         self.do_body()
31
 
32
-        file_set_contents(self.implfile, ''.join(self.impls))
33
-        file_set_contents(self.declfile, ''.join(self.decls))
34
-        file_set_contents(self.docfile, ''.join(self.docs))
35
+        file_set_contents(self.implfile, u('').join(self.impls).encode('utf-8'))
36
+        file_set_contents(self.declfile, u('').join(self.decls).encode('utf-8'))
37
+        file_set_contents(self.docfile, u('').join(self.docs).encode('utf-8'))
38
 
39
     # Header
40
     def do_header(self, f):
(-)net-im/telepathy-logger/files/patch-tools_libglibcodegen.py (+17 lines)
Added Link Here
1
--- tools/libglibcodegen.py.orig	2020-09-23 16:17:54 UTC
2
+++ tools/libglibcodegen.py
3
@@ -154,7 +154,7 @@ def type_to_gtype(s):
4
         return ("GHashTable *", "DBUS_TYPE_G_STRING_STRING_HASHTABLE", "BOXED", False)
5
     elif s[:2] == 'a{':  #some arbitrary hash tables
6
         if s[2] not in ('y', 'b', 'n', 'q', 'i', 'u', 's', 'o', 'g'):
7
-            raise Exception, "can't index a hashtable off non-basic type " + s
8
+            raise Exception("can't index a hashtable off non-basic type " + s)
9
         first = type_to_gtype(s[2])
10
         second = type_to_gtype(s[3:-1])
11
         return ("GHashTable *", "(dbus_g_type_get_map (\"GHashTable\", " + first[1] + ", " + second[1] + "))", "BOXED", False)
12
@@ -169,4 +169,4 @@ def type_to_gtype(s):
13
         return ("GValueArray *", gtype, "BOXED", True)
14
 
15
     # we just don't know ..
16
-    raise Exception, "don't know the GType for " + s
17
+    raise Exception("don't know the GType for " + s)
(-)net-im/telepathy-logger/files/patch-tools_libtpcodegen.py (+58 lines)
Added Link Here
1
--- tools/libtpcodegen.py.orig	2020-09-23 16:17:54 UTC
2
+++ tools/libtpcodegen.py
3
@@ -21,6 +21,7 @@ please make any changes there.
4
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
5
 
6
 import os
7
+import sys
8
 from string import ascii_letters, digits
9
 
10
 
11
@@ -28,6 +29,20 @@ NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpe
12
 
13
 _ASCII_ALNUM = ascii_letters + digits
14
 
15
+if sys.version_info[0] >= 3:
16
+    def u(s):
17
+        """Return s, which must be a str literal with no non-ASCII characters.
18
+        This is like a more restricted form of the Python 2 u'' syntax.
19
+        """
20
+        return s.encode('ascii').decode('ascii')
21
+else:
22
+    def u(s):
23
+        """Return a Unicode version of s, which must be a str literal
24
+        (a bytestring) in which each byte is an ASCII character.
25
+        This is like a more restricted form of the u'' syntax.
26
+        """
27
+        return s.decode('ascii')
28
+
29
 def file_set_contents(filename, contents):
30
     try:
31
         os.remove(filename)
32
@@ -38,13 +53,15 @@ def file_set_contents(filename, contents):
33
     except OSError:
34
         pass
35
 
36
-    open(filename + '.tmp', 'w').write(contents)
37
+    open(filename + '.tmp', 'wb').write(contents)
38
     os.rename(filename + '.tmp', filename)
39
 
40
 def cmp_by_name(node1, node2):
41
     return cmp(node1.getAttributeNode("name").nodeValue,
42
                node2.getAttributeNode("name").nodeValue)
43
 
44
+def key_by_name(node):
45
+    return node.getAttributeNode("name").nodeValue
46
 
47
 def escape_as_identifier(identifier):
48
     """Escape the given string to be a valid D-Bus object path or service
49
@@ -168,6 +185,9 @@ class _SignatureIter:
50
         self.remaining = string
51
 
52
     def next(self):
53
+        return self.__next__()
54
+
55
+    def __next__(self):
56
         if self.remaining == '':
57
             raise StopIteration
58
 
(-)net-im/telepathy-logger/files/patch-tools_xincludator.py (+37 lines)
Added Link Here
1
--- tools/xincludator.py.orig	2020-09-23 16:17:54 UTC
2
+++ tools/xincludator.py
3
@@ -1,17 +1,19 @@
4
 #!/usr/bin/env python
5
 
6
+import sys
7
 from sys import argv, stdout, stderr
8
 import codecs, locale
9
 import os
10
 import xml.dom.minidom
11
 
12
-stdout = codecs.getwriter('utf-8')(stdout)
13
+if sys.version_info[0] < 3:
14
+    stdout = codecs.getwriter('utf-8')(stdout)
15
 
16
 NS_XI = 'http://www.w3.org/2001/XInclude'
17
 
18
 def xincludate(dom, base, dropns = []):
19
     remove_attrs = []
20
-    for i in xrange(dom.documentElement.attributes.length):
21
+    for i in range(dom.documentElement.attributes.length):
22
         attr = dom.documentElement.attributes.item(i)
23
         if attr.prefix == 'xmlns':
24
             if attr.localName in dropns:
25
@@ -34,6 +36,11 @@ if __name__ == '__main__':
26
     argv = argv[1:]
27
     dom = xml.dom.minidom.parse(argv[0])
28
     xincludate(dom, argv[0])
29
-    xml = dom.toxml()
30
+
31
+    if sys.version_info[0] >= 3:
32
+        xml = dom.toxml(encoding=None)
33
+    else:
34
+        xml = dom.toxml()
35
+
36
     stdout.write(xml)
37
     stdout.write('\n')

Return to bug 249549