1 |
Author: zmedico |
2 |
Date: 2008-04-14 17:00:02 +0000 (Mon, 14 Apr 2008) |
3 |
New Revision: 9891 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/__init__.py |
7 |
Log: |
8 |
Revert back to using startwith because I screwed up my benchmark and it |
9 |
turns out starswith is faster than using regular expressions. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/portage/__init__.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/portage/__init__.py 2008-04-14 16:32:19 UTC (rev 9890) |
15 |
+++ main/trunk/pym/portage/__init__.py 2008-04-14 17:00:02 UTC (rev 9891) |
16 |
@@ -2035,12 +2035,8 @@ |
17 |
for var in use_expand: |
18 |
prefix = var.lower() + "_" |
19 |
prefix_len = len(prefix) |
20 |
- prefix_re = re.compile(r'^(%s)(.*)' % prefix) |
21 |
- expand_flags = set() |
22 |
- for x in use: |
23 |
- m = prefix_re.match(x) |
24 |
- if m is not None: |
25 |
- expand_flags.add(m.group(2)) |
26 |
+ expand_flags = set([ x[prefix_len:] for x in use \ |
27 |
+ if x.startswith(prefix) ]) |
28 |
var_split = self.get(var, "").split() |
29 |
# Preserve the order of var_split because it can matter for things |
30 |
# like LINGUAS. |
31 |
@@ -2051,18 +2047,15 @@ |
32 |
var_split = [ x for x in var_split if x != "*" ] |
33 |
has_iuse = set() |
34 |
for x in iuse_implicit: |
35 |
- m = prefix_re.match(x) |
36 |
- if m is not None: |
37 |
- has_iuse.add(m.group(2)) |
38 |
+ if x.startswith(prefix): |
39 |
+ has_iuse.add(x[prefix_len:]) |
40 |
if has_wildcard: |
41 |
# * means to enable everything in IUSE that's not masked |
42 |
if has_iuse: |
43 |
for x in iuse_implicit: |
44 |
- if x in self.usemask: |
45 |
- continue |
46 |
- m = prefix_re.match(x) |
47 |
- if m is not None: |
48 |
- var_split.append(m.group(2)) |
49 |
+ if x.startswith(prefix) and x not in self.usemask: |
50 |
+ suffix = x[prefix_len:] |
51 |
+ var_split.append(suffix) |
52 |
use.add(x) |
53 |
else: |
54 |
# If there is a wildcard and no matching flags in IUSE then |
55 |
|
56 |
-- |
57 |
gentoo-commits@l.g.o mailing list |