summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@qt.io>2019-03-28 13:25:04 +0100
committerJędrzej Nowacki <jedrzej.nowacki@qt.io>2019-03-28 13:18:25 +0000
commita697df786d44b5a9b6fa1de74c807fd8142c4791 (patch)
tree54d366ffbc396fa1082b021291c12fd578615a1b /util
parentce9a1434670196c151c34ce5e0f7ed0718f4215f (diff)
Fix exception when parsing tests.pro
The ParseResults may be a nested list of list. Now the code doesn't raise exceptions, but it fails in do_include as includes that doesn't provide resolved path will fail. Anyway step in the right direction. Change-Id: Ice44e4c10d221293cc6c1facca30abd5495791be Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-xutil/cmake/pro2cmake.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 60fd6297fb..bdc277fa0a 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -629,8 +629,18 @@ class QmakeParser:
Operation = Key('key') + pp.Optional(LC) \
+ Op('operation') + pp.Optional(LC) \
+ Values('value')
- CallArgs = pp.Optional(LC) + pp.nestedExpr()
- CallArgs.setParseAction(lambda x: ' '.join(chain(*x)))
+ CallArgs = pp.Optional(LC) + pp.nestedExpr()\
+
+ def parse_call_args(results):
+ out = ''
+ for item in chain(*results):
+ if isinstance(item, str):
+ out += item
+ else:
+ out += "(" + parse_call_args(item) + ")"
+ return out
+
+ CallArgs.setParseAction(parse_call_args)
Load = pp.Keyword('load') + CallArgs('loaded')
Include = pp.Keyword('include') + CallArgs('included')
Option = pp.Keyword('option') + CallArgs('option')