clayborg added a comment.
Please do convert to python. Just know that you can use "lldb -P" to get the
python path that is needed in order to do "import lldb" in the python script.
So you can try doing a "import lldb", and if that fails, catch the exception,
run "lldb -P", add that path to the python path:
try:
# Just try for LLDB in case the lldb module is already in the python
search
# paths
import lldb
except ImportError:
# We failed to import lldb automatically. Run lldb with the -P option so
# it tells us the python path we should use.
lldb_py_dirs = list()
(status, output) = commands.getstatusoutput("lldb -P")
dir = os.path.realpath(output)
if status == 0 and os.path.isdir(dir):
lldb_py_dirs.append(dir)
success = False
for lldb_py_dir in lldb_py_dirs:
if os.path.exists(lldb_py_dir):
if not (sys.path.__contains__(lldb_py_dir)):
sys.path.append(lldb_py_dir)
try:
import lldb
except ImportError:
pass
else:
success = True
break
if not success:
print("error: couldn't locate the 'lldb' module, please set "
"PYTHONPATH correctly")
sys.exit(1)
https://reviews.llvm.org/D36347
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits