CMake: pro2cmake.py: Improve debugging dump

Make the output of the project structure debug dump more readable.

Change-Id: Ib80b41f7fdb8e14ff878284c46f3760d84f4f004
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Tobias Hunger 2019-01-17 17:10:57 +01:00
parent 1d7e724e39
commit e5bee37762

View File

@ -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!