Skip to content

Commit

Permalink
Rollup merge of rust-lang#42805 - stepancheg:forward-python, r=alexcr…
Browse files Browse the repository at this point in the history
…ichton

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.
  • Loading branch information
frewsxcv authored Jun 22, 2017
2 parents 4a27262 + f441e07 commit c5d12bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ def bootstrap():
env["BUILD"] = rb.build
env["SRC"] = rb.rust_root
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
env["BOOTSTRAP_PYTHON"] = sys.executable
run(args, env=env, verbose=rb.verbose)


Expand Down
7 changes: 7 additions & 0 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use std::env;
use std::ffi::{OsStr, OsString};
use std::fs;
use std::process::Command;
use std::path::PathBuf;

use build_helper::output;

Expand Down Expand Up @@ -86,6 +87,12 @@ pub fn check(build: &mut Build) {
}
}

if build.config.python.is_none() {
// set by bootstrap.py
if let Some(v) = env::var_os("BOOTSTRAP_PYTHON") {
build.config.python = Some(PathBuf::from(v));
}
}
if build.config.python.is_none() {
build.config.python = have_cmd("python2.7".as_ref());
}
Expand Down

0 comments on commit c5d12bc

Please sign in to comment.