summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-11-15 18:12:22 +0000
committerZac Medico <zmedico@gentoo.org>2008-11-15 18:12:22 +0000
commitb233281793c70a96cc5fd466c1a2030854b2b62b (patch)
tree77de90065b12ba3dda83b1e28fc47e91e110a2ce
parentdaef95468ba5e59371260f023301d0bbd429125f (diff)
downloadportage-b233281793c70a96cc5fd466c1a2030854b2b62b.tar.gz
portage-b233281793c70a96cc5fd466c1a2030854b2b62b.tar.bz2
portage-b233281793c70a96cc5fd466c1a2030854b2b62b.zip
Bug #246853 - Redirect all ouput from depgraph.display_problems() to stderr,
except for unsatisfied dependency output which goes to stdout for parsing by programs such as autounmask. (trunk r11947:11949) svn path=/main/branches/2.1.6/; revision=11950
-rw-r--r--pym/_emerge/__init__.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 7e8dd4754..c1ee71ef0 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -7561,8 +7561,35 @@ 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, except for unsatisfied dependencies which
+ go to stdout for parsing by programs such as autounmask.
"""
+ # 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()
+
+ # This goes to stdout for parsing by programs like autounmask.
+ for pargs, kwargs in self._unsatisfied_deps_for_display:
+ self._show_unsatisfied_dep(*pargs, **kwargs)
+
+ def _display_problems(self):
if self._circular_deps_for_display is not None:
self._show_circular_deps(
self._circular_deps_for_display)
@@ -7657,9 +7684,6 @@ class depgraph(object):
show_mask_docs()
print
- for pargs, kwargs in self._unsatisfied_deps_for_display:
- self._show_unsatisfied_dep(*pargs, **kwargs)
-
def calc_changelog(self,ebuildpath,current,next):
if ebuildpath == None or not os.path.exists(ebuildpath):
return []