Skip to content

Commit b405ab1

Browse files
authored
Rollup merge of rust-lang#73590 - davidtwco:bootstrap-fix-config-env-var, r=Mark-Simulacrum
bootstrap: no `config.toml` exists regression Fixes rust-lang#73574. This PR fixes a regression introduced in rust-lang#73317 where an oversight meant that `config.toml` was assumed to exist.
2 parents fda89ea + b60ec47 commit b405ab1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/bootstrap/bootstrap.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -893,15 +893,18 @@ def bootstrap(help_triggered):
893893
build.verbose = args.verbose
894894
build.clean = args.clean
895895

896-
try:
897-
toml_path = os.getenv('RUST_BOOTSTRAP_CONFIG') or args.config or 'config.toml'
896+
# Read from `RUST_BOOTSTRAP_CONFIG`, then `--config`, then fallback to `config.toml` (if it
897+
# exists).
898+
toml_path = os.getenv('RUST_BOOTSTRAP_CONFIG') or args.config
899+
if not toml_path and os.path.exists('config.toml'):
900+
toml_path = 'config.toml'
901+
902+
if toml_path:
898903
if not os.path.exists(toml_path):
899904
toml_path = os.path.join(build.rust_root, toml_path)
900905

901906
with open(toml_path) as config:
902907
build.config_toml = config.read()
903-
except (OSError, IOError):
904-
pass
905908

906909
config_verbose = build.get_toml('verbose', 'build')
907910
if config_verbose is not None:
@@ -947,11 +950,12 @@ def bootstrap(help_triggered):
947950
env["SRC"] = build.rust_root
948951
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
949952
env["BOOTSTRAP_PYTHON"] = sys.executable
950-
env["BOOTSTRAP_CONFIG"] = toml_path
951953
env["BUILD_DIR"] = build.build_dir
952954
env["RUSTC_BOOTSTRAP"] = '1'
953955
env["CARGO"] = build.cargo()
954956
env["RUSTC"] = build.rustc()
957+
if toml_path:
958+
env["BOOTSTRAP_CONFIG"] = toml_path
955959
if build.rustfmt():
956960
env["RUSTFMT"] = build.rustfmt()
957961
run(args, env=env, verbose=build.verbose)

0 commit comments

Comments
 (0)