From: Zac Medico Date: Wed, 13 Mar 2013 15:19:06 +0000 (-0700) Subject: Use writemsg for unicode safety in set messages. X-Git-Tag: v2.2.0_alpha167~37 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ca966f66b92a928c4296e5f0f5bca3c18d83e324;p=portage.git Use writemsg for unicode safety in set messages. --- diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 008a5d579..2c5a1b383 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -3429,15 +3429,18 @@ def expand_set_arguments(myfiles, myaction, root_config): return (None, 1) if myaction in unmerge_actions and \ not sets[s].supportsOperation("unmerge"): - sys.stderr.write("emerge: the given set '%s' does " % s + \ - "not support unmerge operations\n") + writemsg_level("emerge: the given set '%s' does " % s + \ + "not support unmerge operations\n", + level=logging.ERROR, noiselevel=-1) retval = 1 elif not set_atoms: - print("emerge: '%s' is an empty set" % s) + writemsg_level("emerge: '%s' is an empty set\n" % s, + level=logging.INFO, noiselevel=-1) else: newargs.extend(set_atoms) - for e in sets[s].errors: - print(e) + for error_msg in sets[s].errors: + writemsg_level("%s\n" % (error_msg,), + level=logging.ERROR, noiselevel=-1) else: newargs.append(a) return (newargs, retval) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index dfef6a76c..326dd68dd 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2742,7 +2742,8 @@ class depgraph(object): noiselevel=-1) for pset in list(depgraph_sets.sets.values()) + [sets[s]]: for error_msg in pset.errors: - sys.stderr.write("%s\n" % (error_msg,)) + writemsg_level("%s\n" % (error_msg,), + level=logging.ERROR, noiselevel=-1) writemsg_level(("emerge: the given set '%s' " "contains a non-existent set named '%s'.\n") % \ @@ -7076,8 +7077,9 @@ class depgraph(object): for depgraph_sets in self._dynamic_config.sets.values(): for pset in depgraph_sets.sets.values(): - for e in pset.errors: - sys.stderr.write("%s\n" % (e,)) + for error_msg in pset.errors: + writemsg_level("%s\n" % (error_msg,), + level=logging.ERROR, noiselevel=-1) # TODO: Add generic support for "set problem" handlers so that # the below warnings aren't special cases for world only.