diff options
| -rw-r--r-- | lldb/lldb.root | 0 | ||||
| -rw-r--r-- | lldb/lldb_shared_base.py | 15 | ||||
| -rwxr-xr-x | lldb/test/dotest.py | 4 | ||||
| -rw-r--r-- | lldb/test/lldb_shared.py | 22 |
4 files changed, 41 insertions, 0 deletions
diff --git a/lldb/lldb.root b/lldb/lldb.root new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/lldb/lldb.root diff --git a/lldb/lldb_shared_base.py b/lldb/lldb_shared_base.py new file mode 100644 index 00000000000..6612414faff --- /dev/null +++ b/lldb/lldb_shared_base.py @@ -0,0 +1,15 @@ +import inspect +import os +import sys + +def add_third_party_module_dirs(lldb_root): + third_party_modules_dir = os.path.join(lldb_root, "third_party", "Python", "module") + if not os.path.isdir(third_party_modules_dir): + return + + module_dirs = os.listdir(third_party_modules_dir) + for module_dir in module_dirs: + module_dir = os.path.join(third_party_modules_dir, module_dir) + sys.path.append(module_dir) +lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe())) +add_third_party_module_dirs(lldb_root) diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py index f97ce49c6c1..d1fae3b0abc 100755 --- a/lldb/test/dotest.py +++ b/lldb/test/dotest.py @@ -22,6 +22,8 @@ for available options. from __future__ import print_function +import lldb_shared + import atexit import commands import importlib @@ -40,6 +42,8 @@ import inspect import unittest2 import lldbtest_config +import six + def is_exe(fpath): """Returns true if fpath is an executable.""" diff --git a/lldb/test/lldb_shared.py b/lldb/test/lldb_shared.py new file mode 100644 index 00000000000..4d7a92da761 --- /dev/null +++ b/lldb/test/lldb_shared.py @@ -0,0 +1,22 @@ +import inspect +import os +import sys + +def find_lldb_root(): + lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe())) + while True: + lldb_root = os.path.dirname(lldb_root) + if lldb_root is None: + return None + + test_path = os.path.join(lldb_root, "lldb.root") + if os.path.isfile(test_path): + return lldb_root + return None + +lldb_root = find_lldb_root() +if lldb_root is not None: + import imp + module = imp.find_module("lldb_shared_base", [lldb_root]) + if module is not None: + imp.load_module("lldb_shared_base", *module)
\ No newline at end of file |

