summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-07-11 20:23:54 +0000
committerZac Medico <zmedico@gentoo.org>2009-07-11 20:23:54 +0000
commit685e5f293a917ca0dd41c892f231bffaaa66910e (patch)
tree45b5d7ab9ab26a8f216881000a7f60b64b703090
parent54c84db34d5547dabe6bb33cac9a81a62b76ace0 (diff)
downloadportage-685e5f293a917ca0dd41c892f231bffaaa66910e.tar.gz
portage-685e5f293a917ca0dd41c892f231bffaaa66910e.tar.bz2
portage-685e5f293a917ca0dd41c892f231bffaaa66910e.zip
Optimize USE_EXPAND -> USE code inside config.setcpv(). Thanks to
Marat Radchenko <slonopotamusorama@gmail.com> for this patch from bug #276813. svn path=/main/trunk/; revision=13815
-rw-r--r--pym/portage/__init__.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index f31a3f835..5b74e1797 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2387,25 +2387,18 @@ class config(object):
# Use the calculated USE flags to regenerate the USE_EXPAND flags so
# that they are consistent. For optimal performance, use slice
# comparison instead of startswith().
- use_expand_split = self.get("USE_EXPAND", "").split()
+ use_expand_split = set(self.get("USE_EXPAND", "").split())
lazy_use_expand = self._lazy_use_expand(use, self.usemask,
iuse_implicit, use_expand_split, self._use_expand_dict)
- use_expand_iuse = set()
for key in use_expand_split:
prefix = key.lower() + '_'
prefix_len = len(prefix)
- expand_flags = set( x[prefix_len:] for x in use \
+ use_expand_iuse = set( x for x in iuse_implicit \
if x[:prefix_len] == prefix )
- use_expand_iuse.clear()
- for x in iuse_implicit:
- if x[:prefix_len] == prefix:
- use_expand_iuse.add(x)
# * means to enable everything in IUSE that's not masked
- if use_expand_iuse and '*' in expand_flags:
- for x in use_expand_iuse:
- if x not in usemask:
- use.add(x)
if use_expand_iuse:
+ if prefix + '*' in use:
+ use.update( use_expand_iuse.difference(usemask) )
self.configdict['env'].addLazySingleton(
key, lazy_use_expand.__getitem__, key)
else: