FreeBSD Bugzilla – Attachment 218214 Details for
Bug 249549
net-im/telepathy-logger: fix build with python3
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to fix build with python3
telepathy-logger-py3-rev0.diff (text/plain), 17.24 KB, created by
Steve Wills
on 2020-09-23 16:25:36 UTC
(
hide
)
Description:
patch to fix build with python3
Filename:
MIME Type:
Creator:
Steve Wills
Created:
2020-09-23 16:25:36 UTC
Size:
17.24 KB
patch
obsolete
>diff --git net-im/telepathy-logger/Makefile net-im/telepathy-logger/Makefile >index 687fa927723f..48fa12f923d4 100644 >--- net-im/telepathy-logger/Makefile >+++ net-im/telepathy-logger/Makefile >@@ -18,7 +18,7 @@ LIB_DEPENDS= libdbus-glib-1.so:devel/dbus-glib \ > libtelepathy-glib.so:net-im/telepathy-glib > > USES= gettext-tools gmake gnome libtool pathfix pkgconfig \ >- python:2.7,build sqlite tar:bzip2 >+ python:build sqlite tar:bzip2 > GNU_CONFIGURE= yes > USE_LDCONFIG= yes > USE_GNOME= glib20 intltool libxml2 \ >diff --git net-im/telepathy-logger/files/patch-configure net-im/telepathy-logger/files/patch-configure >index ce4c818f908c..c1cec33e57ad 100644 >--- net-im/telepathy-logger/files/patch-configure >+++ net-im/telepathy-logger/files/patch-configure >@@ -1,6 +1,6 @@ >---- configure.orig 2010-08-18 14:48:05.000000000 +0200 >-+++ configure 2010-08-18 14:49:13.000000000 +0200 >-@@ -13281,8 +13281,8 @@ >+--- configure.orig 2015-04-30 11:32:10 UTC >++++ configure >+@@ -14348,8 +14348,8 @@ install-data-am: install-gsettings-schemas > .SECONDARY: $(gsettings_SCHEMAS) > > gsettings__base_list = \ >diff --git net-im/telepathy-logger/files/patch-tools_c-constants-gen.py net-im/telepathy-logger/files/patch-tools_c-constants-gen.py >new file mode 100644 >index 000000000000..69dfa35aa4bd >--- /dev/null >+++ net-im/telepathy-logger/files/patch-tools_c-constants-gen.py >@@ -0,0 +1,39 @@ >+--- tools/c-constants-gen.py.orig 2020-09-23 16:17:54 UTC >++++ 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 net-im/telepathy-logger/files/patch-tools_glib-client-gen.py net-im/telepathy-logger/files/patch-tools_glib-client-gen.py >new file mode 100644 >index 000000000000..d47711800148 >--- /dev/null >+++ net-im/telepathy-logger/files/patch-tools_glib-client-gen.py >@@ -0,0 +1,54 @@ >+--- tools/glib-client-gen.py.orig 2020-09-23 16:17:54 UTC >++++ 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): >+@@ -1187,7 +1181,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 +1234,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 net-im/telepathy-logger/files/patch-tools_glib-client-marshaller-gen.py net-im/telepathy-logger/files/patch-tools_glib-client-marshaller-gen.py >new file mode 100644 >index 000000000000..7ef93f33cd26 >--- /dev/null >+++ net-im/telepathy-logger/files/patch-tools_glib-client-marshaller-gen.py >@@ -0,0 +1,36 @@ >+--- tools/glib-client-marshaller-gen.py.orig 2020-09-23 16:17:54 UTC >++++ 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 net-im/telepathy-logger/files/patch-tools_glib-ginterface-gen.py net-im/telepathy-logger/files/patch-tools_glib-ginterface-gen.py >new file mode 100644 >index 000000000000..b648be770b15 >--- /dev/null >+++ net-im/telepathy-logger/files/patch-tools_glib-ginterface-gen.py >@@ -0,0 +1,67 @@ >+--- tools/glib-ginterface-gen.py.orig 2020-09-23 16:17:54 UTC >++++ 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>') >+@@ -763,12 +757,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 +782,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 net-im/telepathy-logger/files/patch-tools_glib-gtypes-generator.py net-im/telepathy-logger/files/patch-tools_glib-gtypes-generator.py >new file mode 100644 >index 000000000000..432118a10720 >--- /dev/null >+++ net-im/telepathy-logger/files/patch-tools_glib-gtypes-generator.py >@@ -0,0 +1,41 @@ >+--- tools/glib-gtypes-generator.py.orig 2020-09-23 16:17:54 UTC >++++ 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 net-im/telepathy-logger/files/patch-tools_glib-interfaces-gen.py net-im/telepathy-logger/files/patch-tools_glib-interfaces-gen.py >new file mode 100644 >index 000000000000..d28d6da79294 >--- /dev/null >+++ net-im/telepathy-logger/files/patch-tools_glib-interfaces-gen.py >@@ -0,0 +1,40 @@ >+--- tools/glib-interfaces-gen.py.orig 2020-09-23 16:17:54 UTC >++++ 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 net-im/telepathy-logger/files/patch-tools_libglibcodegen.py net-im/telepathy-logger/files/patch-tools_libglibcodegen.py >new file mode 100644 >index 000000000000..40ba243eccfe >--- /dev/null >+++ net-im/telepathy-logger/files/patch-tools_libglibcodegen.py >@@ -0,0 +1,17 @@ >+--- tools/libglibcodegen.py.orig 2020-09-23 16:17:54 UTC >++++ 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 net-im/telepathy-logger/files/patch-tools_libtpcodegen.py net-im/telepathy-logger/files/patch-tools_libtpcodegen.py >new file mode 100644 >index 000000000000..0c94044d29bd >--- /dev/null >+++ net-im/telepathy-logger/files/patch-tools_libtpcodegen.py >@@ -0,0 +1,58 @@ >+--- tools/libtpcodegen.py.orig 2020-09-23 16:17:54 UTC >++++ 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/DbusSpe >+ >+ _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 net-im/telepathy-logger/files/patch-tools_xincludator.py net-im/telepathy-logger/files/patch-tools_xincludator.py >new file mode 100644 >index 000000000000..e32629fd7afb >--- /dev/null >+++ net-im/telepathy-logger/files/patch-tools_xincludator.py >@@ -0,0 +1,37 @@ >+--- tools/xincludator.py.orig 2020-09-23 16:17:54 UTC >++++ tools/xincludator.py >+@@ -1,17 +1,19 @@ >+ #!/usr/bin/env python >+ >++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')
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 249549
: 218214