summaryrefslogtreecommitdiffstats
path: root/lib/bb/data_smart.py
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2013-08-27 16:27:40 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-28 00:33:50 +0100
commit1aa49226d5a2bac911feeb90e3d9f19529bc1a3e (patch)
tree3a86ed7b52763d9e595844a6b153666ea8233d43 /lib/bb/data_smart.py
parent972bc43e6d5b1207b944b3baa8f9805adb35dda7 (diff)
downloadbitbake-contrib-1aa49226d5a2bac911feeb90e3d9f19529bc1a3e.tar.gz
data_smart: use a split/filter/rejoin for _remove
This is more idiomatic, and from the limited performance testing I did, is faster as well. See https://gist.github.com/kergoth/6360248 for the naive benchmark. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/data_smart.py')
-rw-r--r--lib/bb/data_smart.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 3fb88a93d..6229fbf69 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -589,13 +589,9 @@ class DataSmart(MutableMapping):
if expand and value:
value = self.expand(value, None)
if value and flag == "_content" and local_var and "_removeactive" in local_var:
- for i in local_var["_removeactive"]:
- if " " + i + " " in value:
- value = value.replace(" " + i + " ", " ")
- if value.startswith(i + " "):
- value = value[len(i + " "):]
- if value.endswith(" " + i):
- value = value[:-len(" " + i)]
+ filtered = filter(lambda v: v not in local_var["_removeactive"],
+ value.split(" "))
+ value = " ".join(filtered)
return value
def delVarFlag(self, var, flag, **loginfo):