diff options
Diffstat (limited to 'src/bootstrap/bootstrap.py')
| -rw-r--r-- | src/bootstrap/bootstrap.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 01a9792f1b3..68400ba0ea0 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -726,7 +726,7 @@ class RustBuild(object): def should_fix_bins_and_dylibs(self): """Whether or not `fix_bin_or_dylib` needs to be run; can only be True - on NixOS or if config.toml has `build.patch-binaries-for-nix` set. + on NixOS or if bootstrap.toml has `build.patch-binaries-for-nix` set. """ if self._should_fix_bins_and_dylibs is not None: return self._should_fix_bins_and_dylibs @@ -775,7 +775,7 @@ class RustBuild(object): "The IN_NIX_SHELL environment variable is `{}`;".format( in_nix_shell ), - "you may need to set `patch-binaries-for-nix=true` in config.toml", + "you may need to set `patch-binaries-for-nix=true` in bootstrap.toml", ) return is_nixos @@ -884,7 +884,7 @@ class RustBuild(object): return os.path.join(self.build_dir, self.build, subdir) def get_toml(self, key, section=None): - """Returns the value of the given key in config.toml, otherwise returns None + """Returns the value of the given key in bootstrap.toml, otherwise returns None >>> rb = RustBuild() >>> rb.config_toml = 'key1 = "value1"\\nkey2 = "value2"' @@ -1250,17 +1250,23 @@ def bootstrap(args): "unless you put them in place manually." ) - # Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./config.toml`, - # then `config.toml` in the root directory. + # Read from `--config` first, followed by `RUST_BOOTSTRAP_CONFIG`. + # If neither is set, check `./bootstrap.toml`, then `bootstrap.toml` in the root directory. + # If those are unavailable, fall back to `./config.toml`, then `config.toml` for + # backward compatibility. toml_path = args.config or os.getenv("RUST_BOOTSTRAP_CONFIG") using_default_path = toml_path is None if using_default_path: - toml_path = "config.toml" + toml_path = "bootstrap.toml" if not os.path.exists(toml_path): - toml_path = os.path.join(rust_root, toml_path) + toml_path = os.path.join(rust_root, "bootstrap.toml") + if not os.path.exists(toml_path): + toml_path = "config.toml" + if not os.path.exists(toml_path): + toml_path = os.path.join(rust_root, "config.toml") # Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path, - # but not if `config.toml` hasn't been created. + # but not if `bootstrap.toml` hasn't been created. if not using_default_path or os.path.exists(toml_path): with open(toml_path) as config: config_toml = config.read() @@ -1278,7 +1284,9 @@ def bootstrap(args): # profiles to be renamed while maintaining back compatibility # Keep in sync with `profile_aliases` in config.rs profile_aliases = {"user": "dist"} - include_file = "config.{}.toml".format(profile_aliases.get(profile) or profile) + include_file = "bootstrap.{}.toml".format( + profile_aliases.get(profile) or profile + ) include_dir = os.path.join(rust_root, "src", "bootstrap", "defaults") include_path = os.path.join(include_dir, include_file) |
