summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-11-15 17:57:04 +0000
committerZac Medico <zmedico@gentoo.org>2008-11-15 17:57:04 +0000
commitf9f9ee308ffa202ab205ab723a66d8e51c298214 (patch)
tree547d12be8071c213e32e94d4ebfde193e6e2cb06
parent71515ef8bc5a65ef70ddf035efb0d6360e66a313 (diff)
downloadportage-f9f9ee308ffa202ab205ab723a66d8e51c298214.tar.gz
portage-f9f9ee308ffa202ab205ab723a66d8e51c298214.tar.bz2
portage-f9f9ee308ffa202ab205ab723a66d8e51c298214.zip
Bug #246853 - Redirect all ouput from depgraph.display_problems() to stderr.
svn path=/main/trunk/; revision=11948
-rw-r--r--pym/_emerge/__init__.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 159a140df..f09396277 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -7577,8 +7577,30 @@ class depgraph(object):
the merge list where it is most likely to be seen, but if display()
is not going to be called then this method should be called explicitly
to ensure that the user is notified of problems with the graph.
+
+ All output goes to stderr.
"""
+ # Note that show_masked_packages() sends it's output to
+ # stdout, and some programs such as autounmask parse the
+ # output in cases when emerge bails out. However, when
+ # show_masked_packages() is called for installed packages
+ # here, the message is a warning that is more appropriate
+ # to send to stderr, so temporarily redirect stdout to
+ # stderr. TODO: Fix output code so there's a cleaner way
+ # to redirect everything to stderr.
+ sys.stdout.flush()
+ sys.stderr.flush()
+ stdout = sys.stdout
+ try:
+ sys.stdout = sys.stderr
+ self._display_problems()
+ finally:
+ sys.stdout = stdout
+ sys.stdout.flush()
+ sys.stderr.flush()
+
+ def _display_problems(self):
if self._circular_deps_for_display is not None:
self._show_circular_deps(
self._circular_deps_for_display)