1# Module level initialization for the `lldbsuite` module.
2
3import inspect
4import os
5import sys
6
7def 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, "use_lldb_suite_root.py")
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
20lldb_root = find_lldb_root()
21
22# lldbsuite.lldb_test_root refers to the root of the python test tree
23lldb_test_root = os.path.join(
24    lldb_root,
25    "packages",
26    "Python",
27    "lldbsuite",
28    "test")
29