diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-11-13 14:52:54 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-11-13 14:22:09 +0000 |
commit | ab3bbc9d744527fe3d44aa2b23db942b0fad153f (patch) | |
tree | 6c36ec9585a25f1d590dd803852adc3062154e09 | |
parent | 0ca41ee2aa2119857455a460355ab6d059ad3e87 (diff) |
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 <simon.hausmann@qt.io>
-rwxr-xr-x | util/cmake/pro2cmake.py | 2 |
1 files changed, 1 insertions, 1 deletions
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. |