summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-14 17:00:02 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-14 17:00:02 +0000
commitb51eaf64fba63204414f91a000973147dfe1ede8 (patch)
tree40288d638dd52a85e2db22dff97aa570acc5bbb8
parentdaac955d53fdb6c65d25ee499da4bb6d493bb344 (diff)
downloadportage-b51eaf64fba63204414f91a000973147dfe1ede8.tar.gz
portage-b51eaf64fba63204414f91a000973147dfe1ede8.tar.bz2
portage-b51eaf64fba63204414f91a000973147dfe1ede8.zip
Revert back to using startwith because I screwed up my benchmark and it
turns out starswith is faster than using regular expressions. svn path=/main/trunk/; revision=9891
-rw-r--r--pym/portage/__init__.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 59270ac58..5c712a472 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2035,12 +2035,8 @@ class config(object):
for var in use_expand:
prefix = var.lower() + "_"
prefix_len = len(prefix)
- prefix_re = re.compile(r'^(%s)(.*)' % prefix)
- expand_flags = set()
- for x in use:
- m = prefix_re.match(x)
- if m is not None:
- expand_flags.add(m.group(2))
+ expand_flags = set([ x[prefix_len:] for x in use \
+ if x.startswith(prefix) ])
var_split = self.get(var, "").split()
# Preserve the order of var_split because it can matter for things
# like LINGUAS.
@@ -2051,18 +2047,15 @@ class config(object):
var_split = [ x for x in var_split if x != "*" ]
has_iuse = set()
for x in iuse_implicit:
- m = prefix_re.match(x)
- if m is not None:
- has_iuse.add(m.group(2))
+ if x.startswith(prefix):
+ has_iuse.add(x[prefix_len:])
if has_wildcard:
# * means to enable everything in IUSE that's not masked
if has_iuse:
for x in iuse_implicit:
- if x in self.usemask:
- continue
- m = prefix_re.match(x)
- if m is not None:
- var_split.append(m.group(2))
+ if x.startswith(prefix) and x not in self.usemask:
+ suffix = x[prefix_len:]
+ var_split.append(suffix)
use.add(x)
else:
# If there is a wildcard and no matching flags in IUSE then