summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-21 02:24:47 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-21 02:24:47 -0700
commit81de00c7c6d8c591f2e8727fa465af8db5cfbdf1 (patch)
tree4e16b5518a1d2921c9bfda850d16a4d0ccc59b8b
parent492694992a25b3fd7c3db4c304cd72ba53c7cdb9 (diff)
downloadportage-81de00c7c6d8c591f2e8727fa465af8db5cfbdf1.tar.gz
portage-81de00c7c6d8c591f2e8727fa465af8db5cfbdf1.tar.bz2
portage-81de00c7c6d8c591f2e8727fa465af8db5cfbdf1.zip
When stacking incrementals in config.regenerate(), use a set to avoid
relatively inefficient __contains__ and remove operations on a list.
-rw-r--r--pym/portage/package/ebuild/config.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 74a3380c1..bb6ea1ec3 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -2426,9 +2426,10 @@ class config(object):
# repoman will accept any property
self._accept_properties = ('*',)
+ myflags = set()
for mykey in myincrementals:
- myflags=[]
+ myflags.clear()
for curdb in mydbs:
if mykey not in curdb:
continue
@@ -2439,7 +2440,7 @@ class config(object):
if x=="-*":
# "-*" is a special "minus" var that means "unset all settings".
# so USE="-* gnome" will have *just* gnome enabled.
- myflags = []
+ myflags.clear()
continue
if x[0]=="+":
@@ -2452,20 +2453,15 @@ class config(object):
continue
if (x[0]=="-"):
- if (x[1:] in myflags):
- # Unset/Remove it.
- del myflags[myflags.index(x[1:])]
+ myflags.discard(x[1:])
continue
# We got here, so add it now.
- if x not in myflags:
- myflags.append(x)
+ myflags.add(x)
- myflags.sort()
#store setting in last element of configlist, the original environment:
if myflags or mykey in self:
- self.configlist[-1][mykey] = " ".join(myflags)
- del myflags
+ self.configlist[-1][mykey] = " ".join(sorted(myflags))
# Do the USE calculation last because it depends on USE_EXPAND.
if "auto" in self["USE_ORDER"].split(":"):