[PATCH] D67790: prepare_binding_Python: print readable errors if SWIG fails

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 16:41:39 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372442: prepare_binding_Python: print readable errors if SWIG fails (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67790?vs=220940&id=221136#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67790/new/

https://reviews.llvm.org/D67790

Files:
  lldb/trunk/scripts/Python/prepare_binding_Python.py


Index: lldb/trunk/scripts/Python/prepare_binding_Python.py
===================================================================
--- lldb/trunk/scripts/Python/prepare_binding_Python.py
+++ lldb/trunk/scripts/Python/prepare_binding_Python.py
@@ -231,11 +231,13 @@
     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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67790.221136.patch
Type: text/x-patch
Size: 1089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190920/e091e99e/attachment.bin>


More information about the llvm-commits mailing list