Skip to content

Commit dfed688

Browse files
committed
bootstrap: respect build.python on macOS
The `python()` method was hardcoded to return `/usr/bin/python3` on macOS, ignoring the `build.python` config option. This change respects the config while maintaining the system Python as the default.
1 parent c90bcb9 commit dfed688

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/bootstrap/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,10 +1525,11 @@ impl Build {
15251525
/// Path to the python interpreter to use
15261526
fn python(&self) -> &Path {
15271527
if self.config.host_target.ends_with("apple-darwin") {
1528-
// Force /usr/bin/python3 on macOS for LLDB tests because we're loading the
1529-
// LLDB plugin's compiled module which only works with the system python
1530-
// (namely not Homebrew-installed python)
1531-
Path::new("/usr/bin/python3")
1528+
// LLDB tests require the Python version the LLDB plugin was built for.
1529+
// On macOS, the system Python/LLDB are compatible. Many users install
1530+
// Homebrew Python but not Homebrew LLVM, so default to system Python.
1531+
// Can be overridden via `build.python` for custom LLVM installations.
1532+
self.config.python.as_deref().unwrap_or_else(|| Path::new("/usr/bin/python3"))
15321533
} else {
15331534
self.config
15341535
.python

0 commit comments

Comments
 (0)