diff options
author | Steve Wills <swills@FreeBSD.org> | 2020-09-28 20:09:59 +0000 |
---|---|---|
committer | Steve Wills <swills@FreeBSD.org> | 2020-09-28 20:09:59 +0000 |
commit | b90364b34fa501d372eb771c126025a902566f0d (patch) | |
tree | d9561c363d970eb69b46f3c793ed20972c261816 /net-im/telepathy-logger/files/patch-tools_xincludator.py | |
parent | x11/libinput: Update to 1.6.1 (diff) |
telepathy ports: fix build with python 3
PR: 249549
PR: 249550
PR: 249570
PR: 249734
PR: 249735
PR: 249738
Approved by: desktop (tcberner)
Obtained from: ArchLinux, see Bugzilla PRs for details
Notes
Notes:
svn path=/head/; revision=550445
Diffstat (limited to 'net-im/telepathy-logger/files/patch-tools_xincludator.py')
-rw-r--r-- | net-im/telepathy-logger/files/patch-tools_xincludator.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/net-im/telepathy-logger/files/patch-tools_xincludator.py b/net-im/telepathy-logger/files/patch-tools_xincludator.py new file mode 100644 index 000000000000..e32629fd7afb --- /dev/null +++ b/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') |