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>
This commit is contained in:
Alexandru Croitor 2019-11-13 14:52:54 +01:00
parent 0ca41ee2aa
commit ab3bbc9d74

View File

@ -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.