Skip to content

Commit 1681b15

Browse files
committed
Rollup merge of rust-lang#53967 - froydnj:cmake-python-executable, r=alexcrichton
propagate build.python into cmake If a suitable value of Python is not on `PATH`, one can still invoke x.py manually, which propagates `BOOTSTRAP_PYTHON` into the bootstrap environment. But building LLVM will abort with error messages about not being able to find Python, and instructions to set `PYTHON_EXECUTABLE`, because nothing is done with `BOOTSTRAP_PYTHON` when invoking cmake. Setting `build.python` in config.toml had no effect in this scenario, either To fix this, let's provide `PYTHON_EXECUTABLE` when invoking cmake; for the "normal" case of Python in `PATH`, this doesn't alter any behavior. For more unusual cases, however, this ensures cmake finds Python properly. (This change also ensures there are no differences between what bootstrap is using, and what cmake uses, which may be useful for consistency's sake.)
2 parents 776b90c + 62cd02d commit 1681b15

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bootstrap/native.rs

+4
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ impl Step for Llvm {
239239
cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
240240
}
241241

242+
if let Some(ref python) = builder.config.python {
243+
cfg.define("PYTHON_EXECUTABLE", python);
244+
}
245+
242246
configure_cmake(builder, target, &mut cfg, false);
243247

244248
// FIXME: we don't actually need to build all LLVM tools and all LLVM

0 commit comments

Comments
 (0)