Works around a bug in `gn desc` where values can sometimes be reported
as strings when we would expect them to be lists. This was causing
issues with the migration to abseil, as scripts/export_targets.py
did not have a workaround for this bug.

Bug: angleproject:4873
Change-Id: I69994e2cd68a563110fcb98072a24f59f70a06d3
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2380716
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Brian Sheedy 2020-08-27 14:43:23 -07:00 коммит произвёл Commit Bot
Родитель bb33c7cbe0
Коммит a1d05e35a8
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -154,7 +154,13 @@ def flattened_target(target_name: str, descs: dict, stop_at_lib: bool =True) ->
assert dep_type in EXPECTED_TYPES, (k, dep_type)
for (k,v) in dep.items():
if type(v) in (list, tuple, set):
flattened[k] = sortedi(set(flattened.get(k, []) + v))
# This is a workaround for
# https://bugs.chromium.org/p/gn/issues/detail?id=196, where
# the value of "public" can be a string instead of a list.
existing = flattened.get(k, [])
if isinstance(existing, str):
existing = [existing]
flattened[k] = sortedi(set(existing + v))
else:
#flattened.setdefault(k, v)
pass