Zachary Turner | 9e84535 | 2015-10-27 22:54:46 +0000 | [diff] [blame] | 1 | # Module level initialization for the `lldbsuite` module. |
| 2 | |
| 3 | import inspect |
| 4 | import os |
| 5 | import sys |
| 6 | |
| 7 | def find_lldb_root(): |
| 8 | lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe())) |
| 9 | while True: |
| 10 | lldb_root = os.path.dirname(lldb_root) |
| 11 | if lldb_root is None: |
| 12 | return None |
| 13 | |
| 14 | test_path = os.path.join(lldb_root, "lldb.root") |
| 15 | if os.path.isfile(test_path): |
| 16 | return lldb_root |
| 17 | return None |
| 18 | |
| 19 | # lldbsuite.lldb_root refers to the root of the git/svn source checkout |
| 20 | lldb_root = find_lldb_root() |