xref: /openbsd-src/gnu/llvm/lldb/packages/Python/lldbsuite/__init__.py (revision d2c5a4743fb945f45b034a3a830a96f7e1bc695d)
1# Module level initialization for the `lldbsuite` module.
2
3import inspect
4import os
5import sys
6
7
8def find_lldb_root():
9    lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe()))
10    while True:
11        lldb_root = os.path.dirname(lldb_root)
12        if lldb_root is None:
13            return None
14
15        test_path = os.path.join(lldb_root, "use_lldb_suite_root.py")
16        if os.path.isfile(test_path):
17            return lldb_root
18    return None
19
20# lldbsuite.lldb_root refers to the root of the git/svn source checkout
21lldb_root = find_lldb_root()
22
23# lldbsuite.lldb_test_root refers to the root of the python test tree
24lldb_test_root = os.path.join(
25    lldb_root,
26    "packages",
27    "Python",
28    "lldbsuite",
29    "test")
30