Commit e0f097ac authored by Sören Tempel's avatar Sören Tempel
Browse files

community/telepathy-logger: use python3

Requires a patch written by myself.

See #11577

OK Cogitri@
parent 701df73d
......@@ -2,7 +2,7 @@
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=telepathy-logger
pkgver=0.8.2
pkgrel=2
pkgrel=3
pkgdesc="Telepathy framework logging daemon"
url="https://telepathy.freedesktop.org/components/telepathy-logger/"
arch="all"
......@@ -13,14 +13,15 @@ makedepends="
intltool
libxml2-dev
libxslt
python2
python3
sqlite-dev
telepathy-glib-dev
gobject-introspection-dev
"
checkdepends="dbus"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="https://telepathy.freedesktop.org/releases/telepathy-logger/telepathy-logger-$pkgver.tar.bz2"
source="https://telepathy.freedesktop.org/releases/telepathy-logger/telepathy-logger-$pkgver.tar.bz2
python3.patch"
build() {
./configure \
......@@ -44,4 +45,5 @@ package() {
make DESTDIR="$pkgdir" install
}
sha512sums="f3eda26133a4c38eeb79b01cbe3b7801a5eb773e8b4e6ce621c47d3ca701025364c6b2b890caea00104f01ba85ae891a6fad82d7a9dc487fd7a980221cede451 telepathy-logger-0.8.2.tar.bz2"
sha512sums="f3eda26133a4c38eeb79b01cbe3b7801a5eb773e8b4e6ce621c47d3ca701025364c6b2b890caea00104f01ba85ae891a6fad82d7a9dc487fd7a980221cede451 telepathy-logger-0.8.2.tar.bz2
54e8accf12572245e3d02c971d3b2945a52b9e1eb124310ac3ceb80a30f18748ebd80e0cd8a363256e054380182bcd490e4fe6d2dfb68f7effb98f85747341c5 python3.patch"
This patch allows building telepathy-logger with python3.
diff -upr telepathy-logger-0.8.2.orig/tools/c-constants-gen.py telepathy-logger-0.8.2/tools/c-constants-gen.py
--- telepathy-logger-0.8.2.orig/tools/c-constants-gen.py 2015-04-28 18:48:03.000000000 +0200
+++ telepathy-logger-0.8.2/tools/c-constants-gen.py 2020-06-01 12:40:27.165796467 +0200
@@ -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 = []
@@ -25,10 +25,10 @@ class Generator(object):
file_set_contents(self.output_base + '-gtk-doc.h', ''.join(self.__docs))
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 -upr telepathy-logger-0.8.2.orig/tools/glib-client-gen.py telepathy-logger-0.8.2/tools/glib-client-gen.py
--- telepathy-logger-0.8.2.orig/tools/glib-client-gen.py 2015-04-28 18:46:29.000000000 +0200
+++ telepathy-logger-0.8.2/tools/glib-client-gen.py 2020-06-01 12:40:27.162463141 +0200
@@ -28,7 +28,7 @@ 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 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=lambda node : node.getAttributeNode('name').nodeValue)
for node in nodes:
self.do_interface(node)
diff -upr telepathy-logger-0.8.2.orig/tools/glib-client-marshaller-gen.py telepathy-logger-0.8.2/tools/glib-client-marshaller-gen.py
--- telepathy-logger-0.8.2.orig/tools/glib-client-marshaller-gen.py 2015-04-28 18:48:03.000000000 +0200
+++ telepathy-logger-0.8.2/tools/glib-client-marshaller-gen.py 2020-06-01 12:40:27.162463141 +0200
@@ -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.sort()
+ all = list(self.marshallers.keys())
+ sorted(all)
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 -upr telepathy-logger-0.8.2.orig/tools/glib-ginterface-gen.py telepathy-logger-0.8.2/tools/glib-ginterface-gen.py
--- telepathy-logger-0.8.2.orig/tools/glib-ginterface-gen.py 2015-04-28 18:48:03.000000000 +0200
+++ telepathy-logger-0.8.2/tools/glib-ginterface-gen.py 2020-06-01 12:40:27.162463141 +0200
@@ -27,7 +27,7 @@ import os.path
import xml.dom.minidom
from libtpcodegen import file_set_contents
-from libglibcodegen import Signature, type_to_gtype, cmp_by_name, \
+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=lambda node : node.getAttributeNode('name').nodeValue)
self.h('#include <glib-object.h>')
self.h('#include <dbus/dbus-glib.h>')
@@ -768,7 +762,7 @@ class Generator(object):
file_set_contents(self.basename + '-gtk-doc.h', '\n'.join(self.__docs))
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 -upr telepathy-logger-0.8.2.orig/tools/glib-interfaces-gen.py telepathy-logger-0.8.2/tools/glib-interfaces-gen.py
--- telepathy-logger-0.8.2.orig/tools/glib-interfaces-gen.py 2015-04-28 18:48:03.000000000 +0200
+++ telepathy-logger-0.8.2/tools/glib-interfaces-gen.py 2020-06-01 12:40:27.165796467 +0200
@@ -24,13 +24,13 @@ 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:
diff -upr telepathy-logger-0.8.2.orig/tools/libglibcodegen.py telepathy-logger-0.8.2/tools/libglibcodegen.py
--- telepathy-logger-0.8.2.orig/tools/libglibcodegen.py 2015-04-28 18:46:29.000000000 +0200
+++ telepathy-logger-0.8.2/tools/libglibcodegen.py 2020-06-01 12:40:27.165796467 +0200
@@ -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 -upr telepathy-logger-0.8.2.orig/tools/libtpcodegen.py telepathy-logger-0.8.2/tools/libtpcodegen.py
--- telepathy-logger-0.8.2.orig/tools/libtpcodegen.py 2015-04-28 18:46:29.000000000 +0200
+++ telepathy-logger-0.8.2/tools/libtpcodegen.py 2020-06-01 12:40:27.162463141 +0200
@@ -167,7 +167,10 @@ class _SignatureIter:
def __init__(self, string):
self.remaining = string
- def next(self):
+ def __iter__(self):
+ self
+
+ def __next__(self):
if self.remaining == '':
raise StopIteration
diff -upr telepathy-logger-0.8.2.orig/tools/xincludator.py telepathy-logger-0.8.2/tools/xincludator.py
--- telepathy-logger-0.8.2.orig/tools/xincludator.py 2015-04-28 18:46:29.000000000 +0200
+++ telepathy-logger-0.8.2/tools/xincludator.py 2020-06-01 12:40:27.165796467 +0200
@@ -5,13 +5,11 @@ import codecs, locale
import os
import xml.dom.minidom
-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:
@@ -35,5 +33,5 @@ if __name__ == '__main__':
dom = xml.dom.minidom.parse(argv[0])
xincludate(dom, argv[0])
xml = dom.toxml()
- stdout.write(xml)
+ dom.writexml(stdout)
stdout.write('\n')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment