Merge "Make mkstrip always return a string" am: 542399a8e8 am: 360b2b5253

Original change: https://android-review.googlesource.com/c/platform/build/+/2076128

Change-Id: I1b353e509b6100506f581a038c3aae5809d6ad1f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Cole Faust
2022-04-29 18:04:33 +00:00
committed by Automerger Merge Worker

View File

@@ -767,8 +767,11 @@ def _mkstrip(s):
That is, removes string's leading and trailing whitespace characters and That is, removes string's leading and trailing whitespace characters and
replaces any sequence of whitespace characters with with a single space. replaces any sequence of whitespace characters with with a single space.
""" """
if type(s) != "string": t = type(s)
return s if t == "list":
s = " ".join(s)
elif t != "string":
fail("Argument to mkstrip must be a string or list.")
result = "" result = ""
was_space = False was_space = False
for ch in s.strip().elems(): for ch in s.strip().elems():