From: Zac Medico Date: Fri, 9 May 2008 01:49:02 +0000 (-0000) Subject: Optimize BlockerDB.findInstalledBlockers() so that it doesn't unnecessarily X-Git-Tag: v2.2_pre7~59 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9505dddbcae925b9c513932f5149ad4ebbb7499a;p=portage.git Optimize BlockerDB.findInstalledBlockers() so that it doesn't unnecessarily try to match packages against an empty set of blocker atoms. svn path=/main/trunk/; revision=10254 --- diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index e91abf182..1aff570d0 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -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