From a697df786d44b5a9b6fa1de74c807fd8142c4791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Thu, 28 Mar 2019 13:25:04 +0100 Subject: 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 --- util/cmake/pro2cmake.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'util') 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') -- cgit v1.2.3