Skip to content

Commit 03c5f0d

Browse files
bootstrap: force system python3 on MacOS
1 parent b3ff483 commit 03c5f0d

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/bootstrap/lib.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,17 @@ impl Build {
11671167

11681168
/// Path to the python interpreter to use
11691169
fn python(&self) -> &Path {
1170-
self.config.python.as_ref().unwrap()
1170+
if self.config.build.ends_with("apple-darwin") {
1171+
// Force /usr/bin/python3 on macOS for LLDB tests because we're loading the
1172+
// LLDB plugin's compiled module which only works with the system python
1173+
// (namely not Homebrew-installed python)
1174+
Path::new("/usr/bin/python3")
1175+
} else {
1176+
self.config
1177+
.python
1178+
.as_ref()
1179+
.expect("python is required for running LLDB or rustdoc tests")
1180+
}
11711181
}
11721182

11731183
/// Temporary directory that extended error information is emitted to.

src/bootstrap/test.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1403,14 +1403,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
14031403

14041404
cmd.arg("--docck-python").arg(builder.python());
14051405

1406-
if builder.config.build.ends_with("apple-darwin") {
1407-
// Force /usr/bin/python3 on macOS for LLDB tests because we're loading the
1408-
// LLDB plugin's compiled module which only works with the system python
1409-
// (namely not Homebrew-installed python)
1410-
cmd.arg("--lldb-python").arg("/usr/bin/python3");
1411-
} else {
1412-
cmd.arg("--lldb-python").arg(builder.python());
1413-
}
1406+
cmd.arg("--lldb-python").arg(builder.python());
14141407

14151408
if let Some(ref gdb) = builder.config.gdb {
14161409
cmd.arg("--gdb").arg(gdb);

0 commit comments

Comments
 (0)