From e5bee377620de0ca0d80acdd396bbd5804bc2e61 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 17 Jan 2019 17:10:57 +0100 Subject: [PATCH] CMake: pro2cmake.py: Improve debugging dump Make the output of the project structure debug dump more readable. Change-Id: Ib80b41f7fdb8e14ff878284c46f3760d84f4f004 Reviewed-by: Frederik Gladhorn Reviewed-by: Simon Hausmann --- util/cmake/pro2cmake.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 69c6f1fb81a..f95ac43ea87 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -337,16 +337,23 @@ class Scope: def dump(self, *, indent: int = 0) -> None: ind = ' ' * indent if self._condition == '': - print('{}Scope {} in {}.'.format(ind, self._file, self._basedir)) + print('{}Scope {} in "{}".'.format(ind, self._file, self._basedir)) else: - print('{}Scope {} in {} with condition: {}.' + print('{}Scope {} in "{}" with condition: "{}".' .format(ind, self._file, self._basedir, self._condition)) print('{}Keys:'.format(ind)) - for k in sorted(self._operations.keys()): - print('{} {} = "{}"'.format(ind, k, self._operations.get(k, []))) + keys = self._operations.keys() + if not keys: + print('{} -- NONE --'.format(ind)) + else: + for k in sorted(keys): + print('{} {} = "{}"'.format(ind, k, self._operations.get(k, []))) print('{}Children:'.format(ind)) - for c in self._children: - c.dump(indent=indent + 1) + if not self._children: + print('{} -- NONE --'.format(ind)) + else: + for c in self._children: + c.dump(indent=indent + 1) def get(self, key: str, default=None) -> typing.List[str]: assert key != '_INCLUDED' # Special case things that may not recurse!