Skip to content

Commit 2914276

Browse files
committed
Thread python executable path
1 parent b785ad6 commit 2914276

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

cross-project-tests/debuginfo-tests/llgdb-tests/llgdb.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@
99
import subprocess, platform, os, sys
1010

1111
# Set the path to look first for the built lldb (in case it exists).
12-
llvm_libs_dir = os.environ["LLVM_LIBS_DIR"]
13-
built_lldb_path = os.path.join(
14-
llvm_libs_dir,
15-
f"python{sys.version_info.major}.{sys.version_info.minor}",
16-
"site-packages",
17-
)
18-
sys.path.insert(0, built_lldb_path)
12+
lldb_python_path = os.environ["LLDB_PYTHON_PATH"]
13+
if len(lldb_python_path) > 0:
14+
sys.path.insert(0, lldb_python_path)
15+
1916
try:
2017
# Just try for LLDB in case PYTHONPATH is already correctly setup.
2118
import lldb

cross-project-tests/debuginfo-tests/llgdb-tests/test_debuginfo.pl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@
5656
if (!$my_debugger) {
5757
if ($use_lldb) {
5858
my $path = dirname(Cwd::abs_path($0));
59-
$my_debugger = "LLVM_LIBS_DIR=$ENV{'LLVM_LIBS_DIR'} /usr/bin/xcrun python3 $path/llgdb.py";
59+
my $python_exec_path = $ENV{'PYTHON_EXEC_PATH'};
60+
if (!$python_exec_path) {
61+
$python_exec_path = 'python3';
62+
}
63+
$my_debugger = "LLDB_PYTHON_PATH=$ENV{'LLDB_PYTHON_PATH'} /usr/bin/xcrun $python_exec_path $path/llgdb.py";
6064
} else {
6165
$my_debugger = "gdb";
6266
}

cross-project-tests/lit.cfg.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,19 @@
3434

3535
llvm_config.use_default_substitutions()
3636

37+
lldb_python_path = os.path.join(
38+
config.llvm_libs_dir,
39+
f"python{sys.version_info.major}.{sys.version_info.minor}",
40+
"site-packages",
41+
)
42+
python_exec_path = sys.executable
3743
tools = [
3844
ToolSubst(
3945
"%test_debuginfo",
40-
command="LLVM_LIBS_DIR="
41-
+ config.llvm_libs_dir
46+
command="PYTHON_EXEC_PATH="
47+
+ python_exec_path
48+
+ " LLDB_PYTHON_PATH="
49+
+ lldb_python_path
4250
+ " "
4351
+ os.path.join(
4452
config.cross_project_tests_src_root,

0 commit comments

Comments
 (0)