summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-09-22 16:42:16 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-09-23 05:27:50 +0000
commitf0a22bd78dcd07834dcede4f25587eb619c684ba (patch)
treeaaa72483c190c81757604d095b0cfa65bcc449b4
parentfbddf745e9011abd2838b644cbc3258572721d95 (diff)
pro2cmake: Fix regressions introduced by reformat change
Sympy uses eval() inside its code, and that can raise an AttributeError exception, so we have to catch that. This happened when converting qml.pro in qtdeclarative. Also the formatting change removed the raising of an exception when an unhandled function was encountered in handle_function_value, which caused not returning any value in such a case. Instead just return the whole expression string, without checking if the function is in some whitelist. Also encountered in qml.pro. Amends 91634c3c9b8d4f68f0ebd2ac76a8b5b79e4b4c94. Change-Id: I47b73af1de0180becb9ef4fb78a8c35a04928d34 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rwxr-xr-xutil/cmake/pro2cmake.py20
1 files changed, 3 insertions, 17 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 472e4745de..831bda0e6a 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -631,22 +631,8 @@ def handle_function_value(group: pp.ParseResults):
if isinstance(function_args, pp.ParseResults):
function_args = list(flatten_list(function_args.asList()))
- # Return the whole expression as a string.
- if function_name in [
- "join",
- "files",
- "cmakeRelativePath",
- "shell_quote",
- "shadowed",
- "cmakeTargetPath",
- "shell_path",
- "cmakeProcessLibs",
- "cmakeTargetPaths",
- "cmakePortablePaths",
- "escape_expand",
- "member",
- ]:
- return f"join({''.join(function_args)})"
+ # For other functions, return the whole expression as a string.
+ return f"$${function_name}({' '.join(function_args)})"
class Operation:
@@ -2178,7 +2164,7 @@ def simplify_condition(condition: str) -> str:
condition = condition.replace("True", "ON")
condition = condition.replace("False", "OFF")
condition = condition.replace("_dash_", "-")
- except (SympifyError, TypeError):
+ except (SympifyError, TypeError, AttributeError):
# sympy did not like our input, so leave this condition alone:
condition = input_condition