annotate lldb/use_lldb_suite_root.py @ 227:21e6aa2e49ef

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 19 Jul 2021 06:57:16 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 import inspect
anatofuz
parents:
diff changeset
2 import os
anatofuz
parents:
diff changeset
3 import sys
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 def add_third_party_module_dirs(lldb_root):
anatofuz
parents:
diff changeset
7 third_party_modules_dir = os.path.join(
anatofuz
parents:
diff changeset
8 lldb_root, "third_party", "Python", "module")
anatofuz
parents:
diff changeset
9 if not os.path.isdir(third_party_modules_dir):
anatofuz
parents:
diff changeset
10 return
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 module_dirs = os.listdir(third_party_modules_dir)
anatofuz
parents:
diff changeset
13 for module_dir in module_dirs:
anatofuz
parents:
diff changeset
14 module_dir = os.path.join(third_party_modules_dir, module_dir)
anatofuz
parents:
diff changeset
15 sys.path.insert(0, module_dir)
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 def add_lldbsuite_packages_dir(lldb_root):
anatofuz
parents:
diff changeset
19 packages_dir = os.path.join(lldb_root, "packages", "Python")
anatofuz
parents:
diff changeset
20 sys.path.insert(0, packages_dir)
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe()))
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 add_third_party_module_dirs(lldb_root)
anatofuz
parents:
diff changeset
25 add_lldbsuite_packages_dir(lldb_root)