pro2cmake: skip tuple declaration on condition str

In some cases after cleaning and simplifying the conditions
you can end up with the following line:
    ((()))
Python interprets that as an empty tuple:
    >>> a = ((()))
    >>> a
    ()
and then the simplify_condition (sympy) method fails to continue
with an error:
      File ".../util/cmake/pro2cmake.py", line 1993, in simplify_condition
        condition_expr = simplify_logic(condition)
      File ".../sympy/logic/boolalg.py", line 2292, in simplify_logic
        expr = expr.xreplace(dict(zip(variables, s)))
    AttributeError: 'tuple' object has no attribute 'xreplace'

You can see this behavior with the file:
    qtmultimedia/tests/auto/unit/multimediaqml.pro

Change-Id: Ied4285b67f1e567660be49f6610311199bc48a22
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
This commit is contained in:
Cristián Maureira-Fredes 2019-09-19 14:27:18 +02:00 committed by Cristian Maureira-Fredes
parent c40cc543d0
commit 3b7aa8aee8

View File

@ -1598,6 +1598,8 @@ def handle_subdir(
if condition_str and subtraction_str:
condition_str += " AND "
condition_str += subtraction_str
if not condition_str.rstrip("()").strip():
continue
condition_simplified = simplify_condition(condition_str)
condition_key = condition_simplified