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 | |
Zachary Turner | 4c15269 | 2015-11-20 17:40:57 +0000 | [diff] [blame] | 14 | test_path = os.path.join(lldb_root, "use_lldb_suite_root.py") |
Zachary Turner | 9e84535 | 2015-10-27 22:54:46 +0000 | [diff] [blame] | 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() |
Todd Fiala | 1d3b5a3 | 2015-12-07 06:19:48 +0000 | [diff] [blame] | 21 | |
| 22 | # lldbsuite.lldb_test_root refers to the root of the python test tree |
| 23 | lldb_test_root = os.path.join( |
| 24 | lldb_root, |
| 25 | "packages", |
| 26 | "Python", |
| 27 | "lldbsuite", |
| 28 | "test") |