Skip to content

Commit f441e07

Browse files
committed
Pass path to python from bootstrap.py to bootstrap.rs
When bootstrap is executed with python not in `$PATH`, (e. g. `c:\Python27\python.exe x.py test`) bootstrap cannot find python and crashes. This commit passes path to python in `BOOTSTRAP_PYTHON` env var.
1 parent 29bce6e commit f441e07

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/bootstrap/bootstrap.py

+1
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ def bootstrap():
668668
env["BUILD"] = rb.build
669669
env["SRC"] = rb.rust_root
670670
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
671+
env["BOOTSTRAP_PYTHON"] = sys.executable
671672
run(args, env=env, verbose=rb.verbose)
672673

673674

src/bootstrap/sanity.rs

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use std::env;
2323
use std::ffi::{OsStr, OsString};
2424
use std::fs;
2525
use std::process::Command;
26+
use std::path::PathBuf;
2627

2728
use build_helper::output;
2829

@@ -86,6 +87,12 @@ pub fn check(build: &mut Build) {
8687
}
8788
}
8889

90+
if build.config.python.is_none() {
91+
// set by bootstrap.py
92+
if let Some(v) = env::var_os("BOOTSTRAP_PYTHON") {
93+
build.config.python = Some(PathBuf::from(v));
94+
}
95+
}
8996
if build.config.python.is_none() {
9097
build.config.python = have_cmd("python2.7".as_ref());
9198
}

0 commit comments

Comments
 (0)