Merge "If filter/filter_out pattern is a list, remove empty elements from it." am: fe93495fb3
Original change: https://android-review.googlesource.com/c/platform/build/+/1810525 Change-Id: Ic2dc2ced2c48fa763eb8948de80c0569e609e3c5
This commit is contained in:
@@ -439,7 +439,7 @@ def __mk2regex(words):
|
|||||||
"""Returns regular expression equivalent to Make pattern."""
|
"""Returns regular expression equivalent to Make pattern."""
|
||||||
|
|
||||||
# TODO(asmundak): this will mishandle '\%'
|
# TODO(asmundak): this will mishandle '\%'
|
||||||
return "^(" + "|".join([w.replace("%", ".*", 1) for w in words]) + ")"
|
return "^(" + "|".join([w.replace("%", ".*", 1) for w in words if w]) + ")$"
|
||||||
|
|
||||||
def _regex_match(regex, w):
|
def _regex_match(regex, w):
|
||||||
return rblf_regex(regex, w)
|
return rblf_regex(regex, w)
|
||||||
|
@@ -47,6 +47,9 @@ assert_eq(["%/foo"], rblf.mkpatsubst("%", "\\%/%", ["foo"]))
|
|||||||
assert_eq(["foo/%"], rblf.mkpatsubst("%", "%/%", ["foo"]))
|
assert_eq(["foo/%"], rblf.mkpatsubst("%", "%/%", ["foo"]))
|
||||||
assert_eq(["from/a:to/a", "from/b:to/b"], rblf.product_copy_files_by_pattern("from/%", "to/%", "a b"))
|
assert_eq(["from/a:to/a", "from/b:to/b"], rblf.product_copy_files_by_pattern("from/%", "to/%", "a b"))
|
||||||
|
|
||||||
|
assert_eq([], rblf.filter(["a", "", "b"], "f"))
|
||||||
|
assert_eq(["", "b"], rblf.filter_out(["a", "" ], ["a", "", "b"] ))
|
||||||
|
|
||||||
globals, config = rblf.product_configuration("test/device", init)
|
globals, config = rblf.product_configuration("test/device", init)
|
||||||
assert_eq(
|
assert_eq(
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user