CMake: pro2cmake.py: Better printing of scopes
Change-Id: Ibeb77a23c90d3a47c78d17c4683e4af3c64449fc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
4a2562e5db
commit
0c43850687
@ -227,6 +227,10 @@ class Scope:
|
|||||||
self._visited_keys = set() # type: typing.Set[str]
|
self._visited_keys = set() # type: typing.Set[str]
|
||||||
self._total_condition = None # type: typing.Optional[str]
|
self._total_condition = None # type: typing.Optional[str]
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '{}:{}:{}'.format(self._basedir, self._file,
|
||||||
|
self._condition or '<NONE>')
|
||||||
|
|
||||||
def reset_visited_keys(self):
|
def reset_visited_keys(self):
|
||||||
self._visited_keys = set()
|
self._visited_keys = set()
|
||||||
|
|
||||||
@ -276,8 +280,8 @@ class Scope:
|
|||||||
elif operation == '*=':
|
elif operation == '*=':
|
||||||
scope._append_operation(key, UniqueAddOperation(value))
|
scope._append_operation(key, UniqueAddOperation(value))
|
||||||
else:
|
else:
|
||||||
print('Unexpected operation "{}" in scope with '
|
print('Unexpected operation "{}" in scope "{}".'
|
||||||
'condition {}.'.format(operation, cond))
|
.format(operation, scope))
|
||||||
assert(False)
|
assert(False)
|
||||||
|
|
||||||
continue
|
continue
|
||||||
@ -346,11 +350,7 @@ class Scope:
|
|||||||
|
|
||||||
def dump(self, *, indent: int = 0) -> None:
|
def dump(self, *, indent: int = 0) -> None:
|
||||||
ind = ' ' * indent
|
ind = ' ' * indent
|
||||||
if self._condition == '':
|
print('{}Scope "{}":'.format(ind, self))
|
||||||
print('{}Scope {} in "{}".'.format(ind, self._file, self._basedir))
|
|
||||||
else:
|
|
||||||
print('{}Scope {} in "{}" with condition: "{}".'
|
|
||||||
.format(ind, self._file, self._basedir, self._condition))
|
|
||||||
print('{} Keys:'.format(ind))
|
print('{} Keys:'.format(ind))
|
||||||
keys = self._operations.keys()
|
keys = self._operations.keys()
|
||||||
if not keys:
|
if not keys:
|
||||||
@ -576,8 +576,7 @@ def handle_subdir(scope: Scope, cm_fh: typing.IO[str], *,
|
|||||||
cm_fh.write('{}### remove_subdirectory'
|
cm_fh.write('{}### remove_subdirectory'
|
||||||
'("{}")\n'.format(ind, sd[1:]))
|
'("{}")\n'.format(ind, sd[1:]))
|
||||||
else:
|
else:
|
||||||
print(' XXXX: SUBDIR {} in {}: '
|
print(' XXXX: SUBDIR {} in {}: Not found.'.format(sd, scope))
|
||||||
'Not found.'.format(sd, scope.file()))
|
|
||||||
|
|
||||||
for c in scope.children():
|
for c in scope.children():
|
||||||
cond = c.condition()
|
cond = c.condition()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user