[Lldb-commits] [lldb] r372442 - prepare_binding_Python: print readable errors if SWIG fails
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 20 16:41:32 PDT 2019
Author: jdevlieghere
Date: Fri Sep 20 16:41:32 2019
New Revision: 372442
URL: http://llvm.org/viewvc/llvm-project?rev=372442&view=rev
Log:
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
Modified:
lldb/trunk/scripts/Python/prepare_binding_Python.py
Modified: lldb/trunk/scripts/Python/prepare_binding_Python.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/prepare_binding_Python.py?rev=372442&r1=372441&r2=372442&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/prepare_binding_Python.py (original)
+++ lldb/trunk/scripts/Python/prepare_binding_Python.py Fri Sep 20 16:41:32 2019
@@ -231,11 +231,13 @@ def do_swig_rebuild(options, dependency_
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)
More information about the lldb-commits
mailing list