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, "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
20lldb_root = find_lldb_root()
21