summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/resolver/slot_collision.py
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-06-07 20:11:45 +0200
committerZac Medico <zmedico@gentoo.org>2010-08-12 01:17:24 -0700
commitb55d1f658ea6de26329f5c65388e5fb87e3ee38f (patch)
tree190949aad31df653f3aa66432453d560404d3363 /pym/_emerge/resolver/slot_collision.py
parent30d4d5dabaf09454a92cf71dd30be9ff1c5c707e (diff)
downloadportage-b55d1f658ea6de26329f5c65388e5fb87e3ee38f.tar.gz
portage-b55d1f658ea6de26329f5c65388e5fb87e3ee38f.tar.bz2
portage-b55d1f658ea6de26329f5c65388e5fb87e3ee38f.zip
slot_collision_handler: Return a string instead of priting the messages to screen.
Diffstat (limited to 'pym/_emerge/resolver/slot_collision.py')
-rw-r--r--pym/_emerge/resolver/slot_collision.py45
1 files changed, 24 insertions, 21 deletions
diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py
index 116b3368e..bcde037b0 100644
--- a/pym/_emerge/resolver/slot_collision.py
+++ b/pym/_emerge/resolver/slot_collision.py
@@ -92,9 +92,8 @@ class slot_conflict_handler(object):
break
first_config = False
- def print_conflict(self):
- sys.stderr.write("".join(self.conflict_msg))
- sys.stderr.flush()
+ def get_conflict(self):
+ return "".join(self.conflict_msg)
def _prepare_conflict_msg_and_check_for_specificity(self):
"""
@@ -289,34 +288,37 @@ class slot_conflict_handler(object):
msg.append("\n")
msg.append("\n")
- def print_explanation(self):
+ def get_explanation(self):
+ msg = ""
+
if self.is_a_version_conflict:
- return False
+ return None
if self.conflict_is_unspecific and \
not ("--newuse" in self.myopts and "--update" in self.myopts):
- writemsg("!!!Enabling --newuse and --update might solve this conflict.\n")
- writemsg("!!!If not, it might at least allow emerge to give a suggestions.\n\n")
- return True
+ msg += "!!!Enabling --newuse and --update might solve this conflict.\n"
+ msg += "!!!If not, it might at least allow emerge to give a suggestions.\n\n"
+ return msg
solutions = self.solutions
if not solutions:
- return False
+ return None
if len(solutions)==1:
if len(self.slot_collision_info)==1:
- writemsg("It might be possible to solve this slot collision\n")
+ msg += "It might be possible to solve this slot collision\n"
else:
- writemsg("It might be possible to solve these slot collisions\n")
- writemsg("by applying all of the following changes:\n")
+ msg += "It might be possible to solve these slot collisions\n"
+ msg += "by applying all of the following changes:\n"
else:
if len(self.slot_collision_info)==1:
- writemsg("It might be possible to solve this slot collision\n")
+ msg += "It might be possible to solve this slot collision\n"
else:
- writemsg("It might be possible to solve these slot collisions\n")
- writemsg("by applying one of the following solutions:\n")
+ msg += "It might be possible to solve these slot collisions\n"
+ msg += "by applying one of the following solutions:\n"
def print_solution(solution, indent=""):
+ mymsg = ""
for pkg in solution:
changes = []
for flag, state in solution[pkg].items():
@@ -325,17 +327,18 @@ class slot_conflict_handler(object):
elif state == "disabled" and flag in pkg.use.enabled:
changes.append(colorize("blue", "-" + flag))
if changes:
- writemsg(indent + "- " + pkg.cpv + " (Change USE: %s" % " ".join(changes) + ")\n")
- writemsg("\n")
+ mymsg += indent + "- " + pkg.cpv + " (Change USE: %s" % " ".join(changes) + ")\n"
+ mymsg += "\n"
+ return mymsg
if len(solutions) == 1:
- print_solution(solutions[0], " ")
+ msg += print_solution(solutions[0], " ")
else:
for solution in solutions:
- writemsg(" Solution: Apply all of:\n")
- print_solution(solution, " ")
+ msg += " Solution: Apply all of:\n"
+ msg += print_solution(solution, " ")
- return True
+ return msg
def _check_configuration(self, config, all_conflict_atoms_by_slotatom, conflict_nodes):
"""