From 3726b58d3b7c595291c8a3f22ee518dffc382950 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 11 Feb 2019 17:53:54 +0100 Subject: [PATCH] CMake: pro2cmake.py: Simplify condition generation There is no need to try and avoid extra () and NOTs: Those will be removed by sympy later anyway. Change-Id: I39d3e4d1d829579e532bfbbf6c69e0f1e06e9a22 Reviewed-by: Kevin Funk --- util/cmake/pro2cmake.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index f18abcc81fb..90c36fc57c7 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -1000,29 +1000,13 @@ def recursive_evaluate_scope(scope: Scope, parent_condition: str = '', if total_condition == 'else': assert previous_condition, \ "Else branch without previous condition in: %s" % scope.file - if previous_condition.startswith('NOT '): - total_condition = previous_condition[4:] - elif is_simple_condition(previous_condition): - total_condition = 'NOT {}'.format(previous_condition) - else: - total_condition = 'NOT ({})'.format(previous_condition) + total_condition = 'NOT ({})'.format(previous_condition) if parent_condition: if not total_condition: total_condition = parent_condition else: - if is_simple_condition(parent_condition) \ - and is_simple_condition(total_condition): - total_condition = '{} AND {}'.format(parent_condition, + total_condition = '({}) AND ({})'.format(parent_condition, total_condition) - elif is_simple_condition(total_condition): - total_condition = '({}) AND {}'.format(parent_condition, - total_condition) - elif is_simple_condition(parent_condition): - total_condition = '{} AND ({})'.format(parent_condition, - total_condition) - else: - total_condition = '({}) AND ({})'.format(parent_condition, - total_condition) scope.total_condition = simplify_condition(total_condition)