summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-05-09 01:49:02 +0000
committerZac Medico <zmedico@gentoo.org>2008-05-09 01:49:02 +0000
commit9505dddbcae925b9c513932f5149ad4ebbb7499a (patch)
treeb28b4a9249161d2f1db5aa3394773de3de7d6599
parent0be7594ff549e90fe520bf1001d1cf9b93e05c58 (diff)
downloadportage-9505dddbcae925b9c513932f5149ad4ebbb7499a.tar.gz
portage-9505dddbcae925b9c513932f5149ad4ebbb7499a.tar.bz2
portage-9505dddbcae925b9c513932f5149ad4ebbb7499a.zip
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
-rw-r--r--pym/_emerge/__init__.py15
1 files changed, 8 insertions, 7 deletions
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