From ab3bbc9d744527fe3d44aa2b23db942b0fad153f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 13 Nov 2019 14:52:54 +0100 Subject: pro2cmake: Fix generic_version_handler not to be greedy Otherwise in a condition with multiple comparisons, the regexp would match too many characters, and not extract the correct variable name. And to be extra safe, match until a comma is encountered. Change-Id: I29d8344287efca5c5b232006f6bbdf39e6e4ee67 Reviewed-by: Simon Hausmann --- util/cmake/pro2cmake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/cmake') diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 1b4df942f9..dcddfe65d8 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -1370,7 +1370,7 @@ def map_condition(condition: str) -> str: version = match_obj.group(3) return f"({variable} {operator} {version})" - pattern = r"(equals|greaterThan|lessThan)\((.+),[ ]*([0-9]+)\)" + pattern = r"(equals|greaterThan|lessThan)\(([^,]+?),[ ]*([0-9]+)\)" condition = re.sub(pattern, generic_version_handler, condition) # Handle if(...) conditions. -- cgit v1.2.3