summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python/prepare_binding_Python.py
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-09-20 23:41:32 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-09-20 23:41:32 +0000
commit7d6a95cf83fcca92e64302194995601474bc161a (patch)
tree17da31cd69895422842061aef7c60da31dc15b3e /lldb/scripts/Python/prepare_binding_Python.py
parente021d6909436c6baac2dc7c9065340862a9b9aa2 (diff)
downloadbcm5719-llvm-7d6a95cf83fcca92e64302194995601474bc161a.tar.gz
bcm5719-llvm-7d6a95cf83fcca92e64302194995601474bc161a.zip
prepare_binding_Python: print readable errors if SWIG fails
When swig fails, all the errors are squished onto one line with \n quoting. It's very hard to read. This will print them out in a more reasonable format. Patch by: Lawrence D'Anna Differential revision: https://reviews.llvm.org/D67790 llvm-svn: 372442
Diffstat (limited to 'lldb/scripts/Python/prepare_binding_Python.py')
-rw-r--r--lldb/scripts/Python/prepare_binding_Python.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lldb/scripts/Python/prepare_binding_Python.py b/lldb/scripts/Python/prepare_binding_Python.py
index 7d13d6ebb17..fc409b09eb3 100644
--- a/lldb/scripts/Python/prepare_binding_Python.py
+++ b/lldb/scripts/Python/prepare_binding_Python.py
@@ -231,11 +231,13 @@ def do_swig_rebuild(options, dependency_file, config_build_dir, settings):
swig_stdout, swig_stderr = process.communicate()
return_code = process.returncode
if return_code != 0:
+ swig_stdout = swig_stdout.decode('utf8', errors='replace').rstrip()
+ swig_stderr = swig_stderr.decode('utf8', errors='replace').rstrip()
+ swig_stdout = re.sub(r'^(?=.)', 'stdout: ', swig_stdout, flags=re.MULTILINE)
+ swig_stderr = re.sub(r'^(?=.)', 'stderr: ', swig_stderr, flags=re.MULTILINE)
logging.error(
- "swig failed with error code %d: stdout=%s, stderr=%s",
- return_code,
- swig_stdout,
- swig_stderr)
+ "swig failed with error code %d\n%s%s",
+ return_code, swig_stdout, swig_stderr)
logging.error(
"command line:\n%s", ' '.join(command))
sys.exit(return_code)
OpenPOWER on IntegriCloud