Lgtm<br><div class="gmail_quote"><div dir="ltr">On Mon, May 22, 2017 at 6:49 AM Pavel Labath via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">labath created this revision.<br>
<br>
A change in swig 3.0.9 has caused it to generate modules incompatible<br>
with us using them as __init__.py (bug #769). Swig 3.0.11 adds a setting to help<br>
fix this problem, so use that. Support for older versions of swig remains<br>
unaffected.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D33409" rel="noreferrer" target="_blank">https://reviews.llvm.org/D33409</a><br>
<br>
Files:<br>
  scripts/lldb.swig<br>
<br>
<br>
Index: scripts/lldb.swig<br>
===================================================================<br>
--- scripts/lldb.swig<br>
+++ scripts/lldb.swig<br>
@@ -31,8 +31,24 @@<br>
       and a source file location. SBCompileUnit contains SBLineEntry(s)."<br>
 %enddef<br>
<br>
+/*<br>
+Since version 3.0.9, swig's logic for importing the native module has changed in<br>
+a way that is incompatible with our usage of the python module as __init__.py<br>
+(See swig bug #769).  Fortunately, since version 3.0.11, swig provides a way for<br>
+us to override the module import logic to suit our needs. This does that.<br>
+<br>
+Older swig versions will simply ignore this setting.<br>
+*/<br>
+%define MODULEIMPORT<br>
+"import $module"<br>
+%enddef<br>
+// These versions will not generate working python modules, so error out early.<br>
+#if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011<br>
+#error Swig versions 3.0.9 and 3.0.10 are incompatible with lldb.<br>
+#endif<br>
+<br>
 // The name of the module to be created.<br>
-%module(docstring=DOCSTRING) lldb<br>
+%module(docstring=DOCSTRING, moduleimport=MODULEIMPORT) lldb<br>
<br>
 // Parameter types will be used in the autodoc string.<br>
 %feature("autodoc", "1");<br>
<br>
<br>
</blockquote></div>