summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-12-10 07:09:46 +0000
committerZac Medico <zmedico@gentoo.org>2006-12-10 07:09:46 +0000
commit4fa940a3db4ad6b97eab325a071a2f27a4b507fd (patch)
tree273086b5ce8f2eb2150894ca6af4ff4778d0ce7e
parentc1f1947ca51848337051b41c6a48a5ecb3b1d553 (diff)
downloadportage-4fa940a3db4ad6b97eab325a071a2f27a4b507fd.tar.gz
portage-4fa940a3db4ad6b97eab325a071a2f27a4b507fd.tar.bz2
portage-4fa940a3db4ad6b97eab325a071a2f27a4b507fd.zip
Cache the results of match_from_list() calls.
svn path=/main/trunk/; revision=5250
-rw-r--r--pym/portage_dep.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pym/portage_dep.py b/pym/portage_dep.py
index f592d209f..c0f6467e5 100644
--- a/pym/portage_dep.py
+++ b/pym/portage_dep.py
@@ -478,6 +478,8 @@ def best_match_to_list(mypkg, mylist):
bestm = x
return bestm
+_match_from_list_cache = {}
+
def match_from_list(mydep, candidate_list):
"""
Searches list for entries that matches the package.
@@ -490,6 +492,11 @@ def match_from_list(mydep, candidate_list):
@return: A list of package atoms that match the given package atom
"""
+ global _match_from_list_cache
+ mylist = _match_from_list_cache.get((mydep, tuple(candidate_list)), None)
+ if mylist is not None:
+ return mylist[:]
+
from portage_util import writemsg
if mydep[0] == "!":
mydep = mydep[1:]
@@ -585,4 +592,5 @@ def match_from_list(mydep, candidate_list):
else:
raise KeyError("Unknown operator: %s" % mydep)
+ _match_from_list_cache[(mydep, tuple(candidate_list))] = mylist
return mylist