From 210e59514504bd95e63189eceebc32284542d0fa Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 7 Aug 2009 22:37:44 +0000 Subject: Use writemsg_stdout() for safe unicode output. svn path=/main/trunk/; revision=13948 --- pym/_emerge/depgraph.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 3d126ad00..bbc3cd439 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -22,7 +22,7 @@ from portage.output import bold, blue, colorize, create_color_func, darkblue, \ bad = create_color_func("BAD") from portage.sets import SETPREFIX from portage.sets.base import InternalPackageSet -from portage.util import cmp_sort_key, writemsg +from portage.util import cmp_sort_key, writemsg, writemsg_stdout from _emerge.AtomArg import AtomArg from _emerge.Blocker import Blocker @@ -4354,16 +4354,7 @@ class depgraph(object): if "--changelog" in self._frozen_config.myopts: print for revision,text in changelogs: - - if sys.hexversion < 0x3000000: - # avoid potential UnicodeEncodeError - if isinstance(revision, unicode): - revision = revision.encode('utf_8', 'replace') - if isinstance(text, unicode): - text = text.encode('utf_8', 'replace') - - print bold('*'+revision) - sys.stdout.write(text) + writemsg_stdout(bold('*'+revision) + '\n' + text) sys.stdout.flush() return os.EX_OK @@ -5120,13 +5111,8 @@ def show_masked_packages(masked_packages): print "- "+cpv+" (masked by: "+", ".join(mreasons)+")" - if sys.hexversion < 0x3000000 and isinstance(comment, unicode): - # avoid potential UnicodeEncodeError - comment = comment.encode('utf_8', 'replace') - if comment and comment not in shown_comments: - print filename+":" - print comment + writemsg_stdout(filename + ":\n" + comment + "\n") shown_comments.add(comment) portdb = root_config.trees["porttree"].dbapi for l in missing_licenses: -- cgit v1.2.3-1-g7c22