Avoid raising a KeyError from display_preserved_libs() in cases when no
authorZac Medico <zmedico@gentoo.org>
Sun, 5 Oct 2008 16:57:47 +0000 (16:57 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 5 Oct 2008 16:57:47 +0000 (16:57 -0000)
owners are found for a particular library consumer.

svn path=/main/trunk/; revision=11633

pym/_emerge/__init__.py

index 9f72c37891a5764b92a88ebc9e4563d32bdef5dc..e103951fe94b00f216bc8d8c1cf0973055dcce9c 100644 (file)
@@ -10962,11 +10962,12 @@ def display_preserved_libs(vardbapi):
                                print colorize("WARN", " * ") + " - %s" % f
                                consumers = consumer_map[f]
                                for c in consumers[:MAX_DISPLAY]:
-                                       print colorize("WARN", " * ") + "     used by %s (%s)" % (c, ", ".join([x.mycpv for x in owners[c]]))
+                                       print colorize("WARN", " * ") + "     used by %s (%s)" % \
+                                               (c, ", ".join(x.mycpv for x in owners.get(c, [])))
                                if len(consumers) == MAX_DISPLAY + 1:
                                        print colorize("WARN", " * ") + "     used by %s (%s)" % \
-                                               (consumers[MAX_DISPLAY], ", ".join(
-                                               x.mycpv for x in owners[consumers[MAX_DISPLAY]]))
+                                               (consumers[MAX_DISPLAY], ", ".join(x.mycpv \
+                                               for x in owners.get(consumers[MAX_DISPLAY], [])))
                                elif len(consumers) > MAX_DISPLAY:
                                        print colorize("WARN", " * ") + "     used by %d other files" % (len(consumers) - MAX_DISPLAY)
                print "Use " + colorize("GOOD", "emerge @preserved-rebuild") + " to rebuild packages using these libraries"