From: Christopher Larson Date: Tue, 27 Aug 2013 23:27:40 +0000 (-0700) Subject: bitbake: data_smart: use a split/filter/rejoin for _remove X-Git-Tag: rev_ivi_2015_02_04~11242 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03e6584daf1fc2e1958e7e11251a0ca676c93f38;p=scm%2Fbb%2Ftizen-distro.git bitbake: 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. (Bitbake rev: 1aa49226d5a2bac911feeb90e3d9f19529bc1a3e) Signed-off-by: Christopher Larson Signed-off-by: Richard Purdie --- diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 3fb88a9..6229fbf 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/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):