Optimize BlockerDB.findInstalledBlockers() so that it doesn't unnecessarily
authorZac Medico <zmedico@gentoo.org>
Fri, 9 May 2008 01:49:02 +0000 (01:49 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 9 May 2008 01:49:02 +0000 (01:49 -0000)
try to match packages against an empty set of blocker atoms.

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

pym/_emerge/__init__.py

index e91abf1822c1aa2d133c04395a19e46c55a12b31..1aff570d046ea44b45300256cfff2ef56017df7f 100644 (file)
@@ -1608,13 +1608,14 @@ class BlockerDB(object):
 
                blocker_atoms = [atom[1:] for atom in atoms \
                        if atom.startswith("!")]
-               blocker_atoms = InternalPackageSet(initial_atoms=blocker_atoms)
-               for inst_pkg in installed_pkgs:
-                       try:
-                               blocker_atoms.iterAtomsForPackage(inst_pkg).next()
-                       except (portage.exception.InvalidDependString, StopIteration):
-                               continue
-                       blocking_pkgs.add(inst_pkg)
+               if blocker_atoms:
+                       blocker_atoms = InternalPackageSet(initial_atoms=blocker_atoms)
+                       for inst_pkg in installed_pkgs:
+                               try:
+                                       blocker_atoms.iterAtomsForPackage(inst_pkg).next()
+                               except (portage.exception.InvalidDependString, StopIteration):
+                                       continue
+                               blocking_pkgs.add(inst_pkg)
 
                return blocking_pkgs