diff options
| author | David Wood <david@davidtw.co> | 2020-06-13 17:04:06 +0100 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2020-06-16 10:07:34 +0100 |
| commit | 93022be9917a472f7a16410ce7cb2b76a5d3afdd (patch) | |
| tree | b3cd840ac3de610898a2e6914e6eb2b2996b7e42 /src/bootstrap/bootstrap.py | |
| parent | 1fb612bd15bb3ef098fd24c20d0727de573b4410 (diff) | |
| download | rust-93022be9917a472f7a16410ce7cb2b76a5d3afdd.tar.gz rust-93022be9917a472f7a16410ce7cb2b76a5d3afdd.zip | |
bootstrap: read config from $RUST_BOOTSTRAP_CONFIG
This commit modifies bootstrap so that `config.toml` is read first from `RUST_BOOTSTRAP_CONFIG`, then `--config` and finally `config.toml` in the current directory. This is a subjective change, intended to improve the ergnomics when using "development shells" for rustc development (for example, using tools such as Nix) which set environment variables to ensure a reproducible environment (these development shells can then be version controlled). By optionally reading `config.toml` from an environment variable, a `config.toml` can be defined in the development shell and a path to it exposed in the `RUST_BOOTSTRAP_CONFIG` environment variable - avoiding the need to manually symlink the contents of this file to `config.toml` in the working directory. Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'src/bootstrap/bootstrap.py')
| -rw-r--r-- | src/bootstrap/bootstrap.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index b7d0fac5be3..969d16d11e8 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -894,7 +894,7 @@ def bootstrap(help_triggered): build.clean = args.clean try: - toml_path = args.config or 'config.toml' + toml_path = os.getenv('RUST_BOOTSTRAP_CONFIG') or args.config or 'config.toml' if not os.path.exists(toml_path): toml_path = os.path.join(build.rust_root, toml_path) @@ -947,6 +947,7 @@ def bootstrap(help_triggered): env["SRC"] = build.rust_root env["BOOTSTRAP_PARENT_ID"] = str(os.getpid()) env["BOOTSTRAP_PYTHON"] = sys.executable + env["BOOTSTRAP_CONFIG"] = toml_path env["BUILD_DIR"] = build.build_dir env["RUSTC_BOOTSTRAP"] = '1' env["CARGO"] = build.cargo() |
