From 3b7aa8aee855a939984473a0fc32383c43ec7620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Thu, 19 Sep 2019 14:27:18 +0200 Subject: [PATCH] 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 Reviewed-by: Qt CMake Build Bot --- util/cmake/pro2cmake.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 51cce8027c0..df81974ef1e 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -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