summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-16 21:04:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-16 21:04:22 +0000
commit4befb1f96d641a958548654b2c3b674f0ce8404c (patch)
tree664480204c546e55b123766a30e6fcf022c5486e /scripts
parentf1d04915a666728c241bedb36bd99aafee3ea444 (diff)
Notes
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lldb.swig8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/lldb.swig b/scripts/lldb.swig
index 8f1b59c32d4db..8345a4b95038a 100644
--- a/scripts/lldb.swig
+++ b/scripts/lldb.swig
@@ -40,7 +40,13 @@ 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"
+"try:
+ # Try a relative import first
+ from . import $module
+except ImportError:
+ # Maybe absolute import will work (if we're being loaded from lldb, it
+ # should).
+ import $module"
%enddef
// These versions will not generate working python modules, so error out early.
#if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011