diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-24 17:29:21 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-27 07:48:51 +0000 |
commit | cbb143e9f1396c8180401c4f8a5b1fe579902559 (patch) | |
tree | 6c25ee3dfd31e5badf8f4da9fe8201ddd530a71c /util/cmake/helper.py | |
parent | e4f0680c4a722b02fb31fc1693e09059e94326f4 (diff) |
Improve configurejson2cmake.py to handle non-compliant qmake JSON
Some configure.json files contain new lines inside quoted strings,
which is not conformant with the JSON spec.
Add a new json_parser python module which uses pyparsing to preprocess
the json files to remove the new lines inside the quoted strings, and
then hands over the preprocessed content to the regular json module.
Change-Id: I5f8938492068dda5640465cc78f5a7b6be0e709a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Diffstat (limited to 'util/cmake/helper.py')
-rw-r--r-- | util/cmake/helper.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/util/cmake/helper.py b/util/cmake/helper.py index 682e2ec15f..b7d91921fa 100644 --- a/util/cmake/helper.py +++ b/util/cmake/helper.py @@ -428,3 +428,29 @@ def generate_find_package_info(lib: LibraryMapping, ind=one_ind) return result + + +def _set_up_py_parsing_nicer_debug_output(pp): + indent = -1 + + def increase_indent(fn): + def wrapper_function(*args): + nonlocal indent + indent += 1 + print("> " * indent, end="") + return fn(*args) + + return wrapper_function + + def decrease_indent(fn): + def wrapper_function(*args): + nonlocal indent + print("> " * indent, end="") + indent -= 1 + return fn(*args) + + return wrapper_function + + pp._defaultStartDebugAction = increase_indent(pp._defaultStartDebugAction) + pp._defaultSuccessDebugAction = decrease_indent(pp._defaultSuccessDebugAction) + pp._defaultExceptionDebugAction = decrease_indent(pp._defaultExceptionDebugAction) |