itstool: added patch to make itstool pipeable
This commit is contained in:
parent
684431b942
commit
b51b5aa22f
@ -1,6 +1,7 @@
|
||||
untrusted comment: verify with /etc/ports/opt.pub
|
||||
RWSE3ohX2g5d/Td2aKKmAbQzb/ef1lktFU9A8R/z3OkoBY1BzL2usrRtvS3o1OOyqbUbywiEU61S43dlUeHWPYW6G7uyvQnlwQc=
|
||||
SHA256 (Pkgfile) = fd82d110dbdb3b5149c73fd660200f43048d3e17ccafa7abcd35ce8cdb03e90c
|
||||
RWSE3ohX2g5d/en4PKLWdUnJcPdGPKIUqZdMVZ8Gcs/hMm7aJ4sV4AMDbMsAwoo5i8CsLKxkqRuezQfBFdCnIx2vhyByNbcVzw4=
|
||||
SHA256 (Pkgfile) = 57de5782dbe6379f76f127a7e78740330e8d92c696ab90f9ccff4c94f6fc2e59
|
||||
SHA256 (.footprint) = c4575ed0855fe330812c99fc5a1cad8647601e5ef70601a67151289b91d16ee6
|
||||
SHA256 (itstool-2.0.7.tar.bz2) = 6b9a7cd29a12bb95598f5750e8763cee78836a1a207f85b74d8b3275b27e87ca
|
||||
SHA256 (fix_crash_918953.patch) = 6ab00fc14b24acded1dde2d35eaf209a17bdf83c7002cf20abb2281b0c84f8ab
|
||||
SHA256 (fix_crash_912099.patch) = cb57e3694ab3d7c62b063629b2e9edc6327260c0797d0f33c8dc97fe37c40ebb
|
||||
|
@ -5,14 +5,16 @@
|
||||
|
||||
name=itstool
|
||||
version=2.0.7
|
||||
release=2
|
||||
release=3
|
||||
source=(https://files.itstool.org/itstool/$name-$version.tar.bz2
|
||||
fix_crash_918953.patch
|
||||
fix_crash_912099.patch)
|
||||
|
||||
build() {
|
||||
cd $name-$version
|
||||
|
||||
patch -p1 -i $SRC/fix_crash_912099.patch
|
||||
patch -p1 -i $SRC/fix_crash_918953.patch
|
||||
|
||||
PYTHON=/usr/bin/python3 \
|
||||
./configure --prefix=/usr
|
||||
|
40
itstool/fix_crash_918953.patch
Normal file
40
itstool/fix_crash_918953.patch
Normal file
@ -0,0 +1,40 @@
|
||||
Description: Fix the crash from #918953
|
||||
ITS Tool 2.0.4 crashes when output is redictected to a pipe, as reported in
|
||||
#918953. This comes from Python not knowing the preferred encoding for stdout,
|
||||
and using ASCII by default, therefore failing to encode anything outside of it.
|
||||
.
|
||||
This patch makes ITS Tool write to an UTF-8 encoding wrapper around stdout.
|
||||
Bug-Debian: https://bugs.debian.org/918953
|
||||
Author: Tanguy Ortolo <tanguy+debian@ortolo.eu>
|
||||
Last-Update: 2019-01-17
|
||||
|
||||
Index: itstool/itstool.in
|
||||
===================================================================
|
||||
--- itstool.orig/itstool.in 2019-01-17 13:04:20.797021139 -0800
|
||||
+++ itstool/itstool.in 2019-01-17 13:40:20.792936517 -0800
|
||||
@@ -48,6 +48,7 @@
|
||||
"""Return a string that can be safely print()ed"""
|
||||
# Since print works on both bytes and unicode, just return the argument
|
||||
return s
|
||||
+ uout = sys.stdout
|
||||
else:
|
||||
string_types = basestring,
|
||||
ustr = ustr_type = unicode
|
||||
@@ -60,6 +61,8 @@
|
||||
# print may not work on unicode if the output encoding cannot be
|
||||
# detected, so just encode with UTF-8
|
||||
return unicode.encode(s, 'utf-8')
|
||||
+ import codecs
|
||||
+ uout = codecs.getwriter('utf-8')(sys.stdout)
|
||||
|
||||
NS_ITS = 'http://www.w3.org/2005/11/its'
|
||||
NS_ITST = 'http://itstool.org/extensions/'
|
||||
@@ -1565,7 +1568,7 @@
|
||||
if opts.test is None:
|
||||
doc.generate_messages()
|
||||
if opts.output is None or opts.output == '-':
|
||||
- out = sys.stdout
|
||||
+ out = uout
|
||||
else:
|
||||
try:
|
||||
out = io.open(opts.output, 'wt', encoding='utf-8')
|
Loading…
x
Reference in New Issue
Block a user