summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-11-06 21:21:21 +0000
committerZac Medico <zmedico@gentoo.org>2006-11-06 21:21:21 +0000
commitb46477f5c9ae4609741841aed7660f320b8344db (patch)
treed4a7593d3b4840e8d00a07583f2b996d025a4c2b
parent911193a70bad2917b806cc69b853c586f9c33ef0 (diff)
downloadportage-b46477f5c9ae4609741841aed7660f320b8344db.tar.gz
portage-b46477f5c9ae4609741841aed7660f320b8344db.tar.bz2
portage-b46477f5c9ae4609741841aed7660f320b8344db.zip
Minimize getvirtuals() calls and dict lookups inside dep_virtual().
svn path=/main/trunk/; revision=4966
-rw-r--r--pym/portage.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/pym/portage.py b/pym/portage.py
index edb13146d..e438adea8 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -3451,23 +3451,24 @@ def getCPFromCPV(mycpv):
def dep_virtual(mysplit, mysettings):
"Does virtual dependency conversion"
newsplit=[]
+ myvirtuals = mysettings.getvirtuals()
for x in mysplit:
if type(x)==types.ListType:
newsplit.append(dep_virtual(x, mysettings))
else:
mykey=dep_getkey(x)
- myvirtuals = mysettings.getvirtuals()
- if myvirtuals.has_key(mykey):
- if len(myvirtuals[mykey]) == 1:
- a = string.replace(x, mykey, myvirtuals[mykey][0])
+ mychoices = myvirtuals.get(mykey, None)
+ if mychoices:
+ if len(mychoices) == 1:
+ a = x.replace(mykey, mychoices[0])
else:
if x[0]=="!":
# blocker needs "and" not "or(||)".
a=[]
else:
a=['||']
- for y in myvirtuals[mykey]:
- a.append(string.replace(x, mykey, y))
+ for y in mychoices:
+ a.append(x.replace(mykey, y))
newsplit.append(a)
else:
newsplit.append(x)