bootstrap: no config.toml exists regression

This commit fixes a regression introduced in #73317 where an oversight
meant that `config.toml` was assumed to exist.

Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
David Wood 2020-06-21 20:21:17 +01:00
parent 033013cab3
commit b60ec47a06
No known key found for this signature in database
GPG key ID: 2592E76C87381FD9

View file

@ -893,15 +893,18 @@ def bootstrap(help_triggered):
build.verbose = args.verbose build.verbose = args.verbose
build.clean = args.clean build.clean = args.clean
try: # Read from `RUST_BOOTSTRAP_CONFIG`, then `--config`, then fallback to `config.toml` (if it
toml_path = os.getenv('RUST_BOOTSTRAP_CONFIG') or args.config or 'config.toml' # exists).
toml_path = os.getenv('RUST_BOOTSTRAP_CONFIG') or args.config
if not toml_path and os.path.exists('config.toml'):
toml_path = 'config.toml'
if toml_path:
if not os.path.exists(toml_path): if not os.path.exists(toml_path):
toml_path = os.path.join(build.rust_root, toml_path) toml_path = os.path.join(build.rust_root, toml_path)
with open(toml_path) as config: with open(toml_path) as config:
build.config_toml = config.read() build.config_toml = config.read()
except (OSError, IOError):
pass
config_verbose = build.get_toml('verbose', 'build') config_verbose = build.get_toml('verbose', 'build')
if config_verbose is not None: if config_verbose is not None:
@ -947,11 +950,12 @@ def bootstrap(help_triggered):
env["SRC"] = build.rust_root env["SRC"] = build.rust_root
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid()) env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
env["BOOTSTRAP_PYTHON"] = sys.executable env["BOOTSTRAP_PYTHON"] = sys.executable
env["BOOTSTRAP_CONFIG"] = toml_path
env["BUILD_DIR"] = build.build_dir env["BUILD_DIR"] = build.build_dir
env["RUSTC_BOOTSTRAP"] = '1' env["RUSTC_BOOTSTRAP"] = '1'
env["CARGO"] = build.cargo() env["CARGO"] = build.cargo()
env["RUSTC"] = build.rustc() env["RUSTC"] = build.rustc()
if toml_path:
env["BOOTSTRAP_CONFIG"] = toml_path
if build.rustfmt(): if build.rustfmt():
env["RUSTFMT"] = build.rustfmt() env["RUSTFMT"] = build.rustfmt()
run(args, env=env, verbose=build.verbose) run(args, env=env, verbose=build.verbose)