diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-01-31 12:17:27 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-01-31 15:23:22 +0000 |
commit | cfbb110abe3f3ac9c85c9e2cf0bbe587f1082af5 (patch) | |
tree | 40bae97b6e64243b57ce5ce2934fd1bf6402d9ab | |
parent | 0efd241d200e4080d80bc8336514a656583e2d18 (diff) |
CMake: pro2cmake.py: Assign a unique id to each scope
This makes scopes much simpler to destinguish from each other.
Change-Id: I1af42f181b5899aba749bcf9267a345385149f90
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rwxr-xr-x | util/cmake/pro2cmake.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 15c35ac9ae..dd1ed59255 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -207,6 +207,9 @@ class RemoveOperation(Operation): class Scope(object): + + SCOPE_ID: int = 1 + def __init__(self, *, parent_scope: typing.Optional[Scope], file: typing.Optional[str] = None, condition: str = '', @@ -225,6 +228,8 @@ class Scope(object): if not self._basedir: self._basedir = self._currentdir + self._scope_id = Scope.SCOPE_ID + Scope.SCOPE_ID += 1 self._file = file self._condition = map_condition(condition) self._children = [] # type: typing.List[Scope] @@ -234,8 +239,8 @@ class Scope(object): def __repr__(self): debug_mark = ' [MERGE_DEBUG]' if self.merge_debug else '' - return '{}:{}:{}{}'.format(self._basedir, self._file, - self._condition or '<NONE>', debug_mark) + return '{}:{}:{}:{}{}'.format(self._scope_id, self._basedir, self._file, + self._condition or '<NONE>', debug_mark) def reset_visited_keys(self): self._visited_keys = set() |