Zachary Turner | 8741e31 | 2015-10-20 21:05:57 +0000 | [diff] [blame] | 1 | import inspect |
| 2 | import os |
| 3 | import sys |
| 4 | |
| 5 | def find_lldb_root(): |
| 6 | lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe())) |
| 7 | while True: |
| 8 | lldb_root = os.path.dirname(lldb_root) |
| 9 | if lldb_root is None: |
| 10 | return None |
| 11 | |
| 12 | test_path = os.path.join(lldb_root, "lldb.root") |
| 13 | if os.path.isfile(test_path): |
| 14 | return lldb_root |
| 15 | return None |
| 16 | |
| 17 | lldb_root = find_lldb_root() |
| 18 | if lldb_root is not None: |
| 19 | import imp |
Zachary Turner | 0a0490b | 2015-10-27 20:12:05 +0000 | [diff] [blame] | 20 | module = imp.find_module("use_lldb_suite_root", [lldb_root]) |
Zachary Turner | 8741e31 | 2015-10-20 21:05:57 +0000 | [diff] [blame] | 21 | if module is not None: |
Zachary Turner | 0a0490b | 2015-10-27 20:12:05 +0000 | [diff] [blame] | 22 | imp.load_module("use_lldb_suite_root", *module) |