resolver: output: check for None mainRepo()
authorBrandon Philips <brandon@ifup.co>
Wed, 20 Mar 2013 18:13:53 +0000 (11:13 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 20 Mar 2013 19:23:10 +0000 (12:23 -0700)
mainRepo() can return none when we are on a machine that is only using
PORTAGE_BINHOST and not a normal PORTAGE. Make sure we don't crash here.

pym/_emerge/resolver/output.py

index 46a13bf6af4dbc31df7a7634ac42fd76cc867a8c..a14478ee10010dd2b5e8d2a915a4a74b4a90832b 100644 (file)
@@ -385,7 +385,7 @@ class Display(object):
                                                if old_pkg.slot != old_pkg.sub_slot or \
                                                        old_pkg.slot == pkg.slot and old_pkg.sub_slot != pkg.sub_slot:
                                                        key += "/" + old_pkg.sub_slot
-                                       if not self.quiet_repo_display and (self.verbose_main_repo_display or
+                                       if not self.quiet_repo_display and self.portdb.repositories.mainRepo() and (self.verbose_main_repo_display or
                                                any(x.repo != self.portdb.repositories.mainRepo().name for x in myoldbest + [pkg])):
                                                key += _repo_separator + old_pkg.repo
                                versions.append(key)
@@ -419,7 +419,7 @@ class Display(object):
                @param pkg_info: dictionary
                @rtype string
                """
-               if not self.quiet_repo_display and (self.verbose_main_repo_display or
+               if not self.quiet_repo_display and self.portdb.repositories.mainRepo() and (self.verbose_main_repo_display or
                        any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg])):
                        pkg_str += _repo_separator + pkg.repo
                return pkg_str