From b3ff4835befc318f59ece942923ce55e4b2f1aa5 Mon Sep 17 00:00:00 2001 From: Alec Goncharow Date: Tue, 29 Mar 2022 12:43:21 -0400 Subject: [PATCH 1/2] bootstrap: loosen and expand python check bounds --- src/bootstrap/sanity.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 8c2899c1ac0..c96e6f9a367 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -103,7 +103,9 @@ pub fn check(build: &mut Build) { .take() .map(|p| cmd_finder.must_have(p)) .or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py - .or_else(|| Some(cmd_finder.must_have("python"))); + .or_else(|| cmd_finder.maybe_have("python")) + .or_else(|| cmd_finder.maybe_have("python3")) + .or_else(|| cmd_finder.maybe_have("python2")); build.config.nodejs = build .config From 03c5f0d2182cc36548b782599412408349b13cbb Mon Sep 17 00:00:00 2001 From: Alec Goncharow Date: Tue, 29 Mar 2022 12:45:54 -0400 Subject: [PATCH 2/2] bootstrap: force system python3 on MacOS --- src/bootstrap/lib.rs | 12 +++++++++++- src/bootstrap/test.rs | 9 +-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 8f076ad914d..0736c4464b9 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1167,7 +1167,17 @@ fn qemu_rootfs(&self, target: TargetSelection) -> Option<&Path> { /// Path to the python interpreter to use fn python(&self) -> &Path { - self.config.python.as_ref().unwrap() + if self.config.build.ends_with("apple-darwin") { + // Force /usr/bin/python3 on macOS for LLDB tests because we're loading the + // LLDB plugin's compiled module which only works with the system python + // (namely not Homebrew-installed python) + Path::new("/usr/bin/python3") + } else { + self.config + .python + .as_ref() + .expect("python is required for running LLDB or rustdoc tests") + } } /// Temporary directory that extended error information is emitted to. diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index c8b76809aba..00ede2140a6 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1403,14 +1403,7 @@ fn run(self, builder: &Builder<'_>) { cmd.arg("--docck-python").arg(builder.python()); - if builder.config.build.ends_with("apple-darwin") { - // Force /usr/bin/python3 on macOS for LLDB tests because we're loading the - // LLDB plugin's compiled module which only works with the system python - // (namely not Homebrew-installed python) - cmd.arg("--lldb-python").arg("/usr/bin/python3"); - } else { - cmd.arg("--lldb-python").arg(builder.python()); - } + cmd.arg("--lldb-python").arg(builder.python()); if let Some(ref gdb) = builder.config.gdb { cmd.arg("--gdb").arg(gdb);