cmake scripts: Do not add empty child conditions into condition list
c.condition can be None, there is no point in adding it into the set of conditions. An example is tests/auto/corelib/codecs/qtextcodec/test.pro Initializing the set to an empty set instead of None makes mypy happy, since we could otherwise end up passing None where frozenset was expected. Change-Id: If88a86d810b4c55aae7f1ee97a62db559abfc86d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
03f365f93e
commit
c0618eb583
@ -1671,7 +1671,7 @@ def handle_subdir(
|
|||||||
cm_fh: IO[str],
|
cm_fh: IO[str],
|
||||||
*,
|
*,
|
||||||
indent: int = 0,
|
indent: int = 0,
|
||||||
current_conditions: FrozenSet[str] = None,
|
current_conditions: FrozenSet[str] = frozenset(),
|
||||||
is_example: bool = False,
|
is_example: bool = False,
|
||||||
):
|
):
|
||||||
for sd in scope.get_files("SUBDIRS"):
|
for sd in scope.get_files("SUBDIRS"):
|
||||||
@ -1705,12 +1705,16 @@ def handle_subdir(
|
|||||||
for c in scope.children:
|
for c in scope.children:
|
||||||
# Use total_condition for 'else' conditions, otherwise just use the regular value to
|
# Use total_condition for 'else' conditions, otherwise just use the regular value to
|
||||||
# simplify the logic.
|
# simplify the logic.
|
||||||
|
child_conditions = current_conditions
|
||||||
child_condition = c.total_condition if c.condition == "else" else c.condition
|
child_condition = c.total_condition if c.condition == "else" else c.condition
|
||||||
|
if child_condition:
|
||||||
|
child_conditions = frozenset((*child_conditions, child_condition))
|
||||||
|
|
||||||
handle_subdir_helper(
|
handle_subdir_helper(
|
||||||
c,
|
c,
|
||||||
cm_fh,
|
cm_fh,
|
||||||
indent=indent + 1,
|
indent=indent + 1,
|
||||||
current_conditions=frozenset((*current_conditions, child_condition)),
|
current_conditions=child_conditions,
|
||||||
is_example=is_example,
|
is_example=is_example,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user