SHA256
1
0
forked from pool/rpmlint

Accepting request 363155 from devel:openSUSE:Factory:rpmlint

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/363155
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=247
This commit is contained in:
Dominique Leuenberger 2016-03-07 12:36:42 +00:00 committed by Git OBS Bridge
commit 200793cc5e
3 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,50 @@
From 8169818dbad3f8f6fccbc7e3de99e86b37ad45f6 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Mon, 22 Feb 2016 09:12:39 +0100
Subject: [PATCH] Solve exceptions on printing str (Fixes #61)
Handle printing of str gracefully by first encoding
it to unicode before printing it in the proper encoding.
Also fix python2 check.
---
Filter.py | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
Index: rpmlint-rpmlint-1.8/Filter.py
===================================================================
--- rpmlint-rpmlint-1.8.orig/Filter.py
+++ rpmlint-rpmlint-1.8/Filter.py
@@ -24,20 +24,20 @@ _diagnostic = list()
_badness_score = 0
printed_messages = {"I": 0, "W": 0, "E": 0}
-if sys.stdout.isatty():
- def __print(s):
- print(s)
-else:
- __stdout = sys.stdout
- if not __stdout.encoding: # Python < 3 only?
- import codecs
- if hasattr(__stdout, "buffer"):
- __stdout = __stdout.buffer
- __stdout = codecs.getwriter(
- locale.getpreferredencoding())(__stdout, "replace")
+__stdout = sys.stdout
+__preferred_encoding = locale.getpreferredencoding()
+if hasattr(__stdout, 'xreadlines'): # Python < 3 only
+ import codecs
+ if hasattr(__stdout, "buffer"):
+ __stdout = __stdout.buffer
+ __stdout = codecs.getwriter(
+ __preferred_encoding)(sys.stdout, 'replace')
- def __print(s):
- print(s, file=__stdout)
+
+def __print(s):
+ if isinstance(s, str) and hasattr(s, 'decode'):
+ s = s.decode(__preferred_encoding, 'replace')
+ print(s, file=__stdout)
def printInfo(pkg, reason, *details):

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Feb 22 08:16:34 UTC 2016 - dmueller@suse.com
- add 0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch (bsc#967556)
- fix requires
-------------------------------------------------------------------
Fri Feb 12 14:43:00 UTC 2016 - sleep_walker@opensuse.org

View File

@ -47,6 +47,7 @@ Requires: desktop-file-utils
Requires: file
Requires: findutils
Requires: python-magic
Requires: python-xml
Requires: rpm-python
# Requirement for ErlangCheck.py (pull-request #2).
Requires: python-pybeam
@ -110,6 +111,7 @@ Patch50: fix-shared-library-matching.diff
Patch51: postin-speedup.diff
# https://github.com/rpm-software-management/rpmlint/commit/37fe9d4f237c2cb29fcb3b60d1ece189e578eeaf.patch and followup regression fixes
Patch52: binaryinfo-speedup.diff
Patch53: 0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch
# PATCHLIST END
# BuildArch must at the end. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766
BuildArch: noarch