2015-10-21 05:05:57 +08:00
|
|
|
import inspect
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-21 05:05:57 +08:00
|
|
|
def find_lldb_root():
|
2018-08-04 05:37:01 +08:00
|
|
|
lldb_root = os.path.dirname(
|
|
|
|
os.path.abspath(inspect.getfile(inspect.currentframe()))
|
|
|
|
)
|
2015-10-21 05:05:57 +08:00
|
|
|
while True:
|
|
|
|
lldb_root = os.path.dirname(lldb_root)
|
|
|
|
if lldb_root is None:
|
|
|
|
return None
|
|
|
|
|
2015-11-21 01:40:57 +08:00
|
|
|
test_path = os.path.join(lldb_root, "use_lldb_suite_root.py")
|
2015-10-21 05:05:57 +08:00
|
|
|
if os.path.isfile(test_path):
|
|
|
|
return lldb_root
|
|
|
|
return None
|
|
|
|
|
|
|
|
lldb_root = find_lldb_root()
|
|
|
|
if lldb_root is not None:
|
|
|
|
import imp
|
2016-01-16 06:22:35 +08:00
|
|
|
fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root])
|
|
|
|
try:
|
|
|
|
imp.load_module("use_lldb_suite_root", fp, pathname, desc)
|
|
|
|
finally:
|
|
|
|
if fp:
|
|
|
|
fp.close()
|