Merge "Make words() work on a list of non-strings" am: 6086c5ce5f
am: 780964e41b
am: 3c35c4651f
Original change: https://android-review.googlesource.com/c/platform/build/+/2424056 Change-Id: I954152e4876f13318e75ce8acca7bdccc8bb9d66 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -462,6 +462,9 @@ def _addsuffix(suffix, string_or_list):
|
||||
|
||||
def __words(string_or_list):
|
||||
if type(string_or_list) == "list":
|
||||
for x in string_or_list:
|
||||
if type(x) != "string":
|
||||
return string_or_list
|
||||
string_or_list = " ".join(string_or_list)
|
||||
return _mkstrip(string_or_list).split()
|
||||
|
||||
|
@@ -46,6 +46,11 @@ assert_eq("", rblf.mkstrip(" \n \t "))
|
||||
assert_eq("a b c", rblf.mkstrip(" a b \n c \t"))
|
||||
assert_eq("1", rblf.mkstrip("1 "))
|
||||
|
||||
assert_eq(["a", "b"], rblf.words("a b"))
|
||||
assert_eq(["a", "b", "c"], rblf.words(["a b", "c"]))
|
||||
# 1-tuple like we use in product variables
|
||||
assert_eq(["a b", ("c",)], rblf.words(["a b", ("c",)]))
|
||||
|
||||
assert_eq("b1 b2", rblf.mksubst("a", "b", "a1 a2"))
|
||||
assert_eq(["b1", "x2"], rblf.mksubst("a", "b", ["a1", "x2"]))
|
||||
|
||||
|
Reference in New Issue
Block a user