Skip to content

Commit 3904658

Browse files
committed
Inline the .expect() from bootstrap::python() and remove it
The choice of default for macOS was moved to sanity::check()
1 parent 4f6d373 commit 3904658

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,13 @@ Please disable assertions with `rust.debug-assertions = false`.
20752075
cmd.arg("--target-rustcflags").arg(flag);
20762076
}
20772077

2078-
cmd.arg("--python").arg(builder.python());
2078+
cmd.arg("--python").arg(
2079+
builder
2080+
.config
2081+
.python
2082+
.as_ref()
2083+
.expect("python is required for running LLDB or rustdoc tests"),
2084+
);
20792085

20802086
// FIXME(#148099): Currently we set these Android-related flags in all
20812087
// modes, even though they should only be needed in "debuginfo" mode,
@@ -3359,7 +3365,9 @@ impl Step for BootstrapPy {
33593365
}
33603366

33613367
fn run(self, builder: &Builder<'_>) -> Self::Output {
3362-
let mut check_bootstrap = command(builder.python());
3368+
let mut check_bootstrap = command(
3369+
builder.config.python.as_ref().expect("python is required for running bootstrap tests"),
3370+
);
33633371
check_bootstrap
33643372
.args(["-m", "unittest", "bootstrap_test.py"])
33653373
// Forward command-line args after `--` to unittest, for filtering etc.

src/bootstrap/src/lib.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,22 +1522,6 @@ impl Build {
15221522
self.config.target_config.get(&target).and_then(|t| t.qemu_rootfs.as_ref()).map(|p| &**p)
15231523
}
15241524

1525-
/// Path to the python interpreter to use
1526-
fn python(&self) -> &Path {
1527-
if self.config.host_target.ends_with("apple-darwin") {
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"))
1533-
} else {
1534-
self.config
1535-
.python
1536-
.as_ref()
1537-
.expect("python is required for running LLDB or rustdoc tests")
1538-
}
1539-
}
1540-
15411525
/// Temporary directory that extended error information is emitted to.
15421526
fn extended_error_dir(&self) -> PathBuf {
15431527
self.out.join("tmp/extended-error-metadata")

0 commit comments

Comments
 (0)