summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-05-23 10:55:17 +0000
committerPavel Labath <labath@google.com>2017-05-23 10:55:17 +0000
commitb8372cfa33c93bf30839a591453eda6e907740e8 (patch)
treed42fff4a0ca52dd09caca242ca688ea0480149c3
parentcc4f1e49afd3fe9f730e955e7368242082bb198b (diff)
downloadbcm5719-llvm-b8372cfa33c93bf30839a591453eda6e907740e8.tar.gz
bcm5719-llvm-b8372cfa33c93bf30839a591453eda6e907740e8.zip
Add support for new (3.0.11+) swigs
Summary: A change in swig 3.0.9 has caused it to generate modules incompatible with us using them as __init__.py (bug #769). Swig 3.0.11 adds a setting to help fix this problem, so use that. Support for older versions of swig remains unaffected. Reviewers: zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D33409 llvm-svn: 303627
-rw-r--r--lldb/scripts/lldb.swig18
1 files changed, 17 insertions, 1 deletions
diff --git a/lldb/scripts/lldb.swig b/lldb/scripts/lldb.swig
index b0325e611d7..8f1b59c32d4 100644
--- a/lldb/scripts/lldb.swig
+++ b/lldb/scripts/lldb.swig
@@ -31,8 +31,24 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions
and a source file location. SBCompileUnit contains SBLineEntry(s)."
%enddef
+/*
+Since version 3.0.9, swig's logic for importing the native module has changed in
+a way that is incompatible with our usage of the python module as __init__.py
+(See swig bug #769). Fortunately, since version 3.0.11, swig provides a way for
+us to override the module import logic to suit our needs. This does that.
+
+Older swig versions will simply ignore this setting.
+*/
+%define MODULEIMPORT
+"from . import $module"
+%enddef
+// These versions will not generate working python modules, so error out early.
+#if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011
+#error Swig versions 3.0.9 and 3.0.10 are incompatible with lldb.
+#endif
+
// The name of the module to be created.
-%module(docstring=DOCSTRING) lldb
+%module(docstring=DOCSTRING, moduleimport=MODULEIMPORT) lldb
// Parameter types will be used in the autodoc string.
%feature("autodoc", "1");
OpenPOWER on IntegriCloud