diff options
| author | bors <bors@rust-lang.org> | 2025-06-23 12:38:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-06-23 12:38:27 +0000 |
| commit | 42245d34d22ade32b3f276dcf74deb826841594c (patch) | |
| tree | 8b813764cf5705a92cf4be577b8ec223d1875b61 /src/bootstrap/configure.py | |
| parent | ae2fc9722f08ef131407c1dc8057768868f65e8e (diff) | |
| parent | 3e8e06545e8152c98f0d5ec75a6116b8070d9f8e (diff) | |
| download | rust-42245d34d22ade32b3f276dcf74deb826841594c.tar.gz rust-42245d34d22ade32b3f276dcf74deb826841594c.zip | |
Auto merge of #142906 - jdonszelmann:rollup-togt1dl, r=jdonszelmann
Rollup of 5 pull requests Successful merges: - rust-lang/rust#142493 (rework `#[naked]` attribute parser) - rust-lang/rust#142636 (bootstrap.example.toml: use less contextual format) - rust-lang/rust#142822 (Make `PartialEq` a `const_trait`) - rust-lang/rust#142892 (Fix ICE on debug builds where lints are delayed on the crate root) - rust-lang/rust#142904 (notify me when rdg is touched) Failed merges: - rust-lang/rust#142827 (Move error code explanation removal check into tidy) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/bootstrap/configure.py')
| -rwxr-xr-x | src/bootstrap/configure.py | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 0d4d6e0ff54..c077555b906 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function import shlex import sys import os +import re rust_dir = os.path.dirname(os.path.abspath(__file__)) rust_dir = os.path.dirname(rust_dir) @@ -585,16 +586,31 @@ def parse_example_config(known_args, config): section_order = [None] targets = {} top_level_keys = [] + comment_lines = [] with open(rust_dir + "/bootstrap.example.toml") as example_config: example_lines = example_config.read().split("\n") for line in example_lines: - if cur_section is None: - if line.count("=") == 1: - top_level_key = line.split("=")[0] - top_level_key = top_level_key.strip(" #") - top_level_keys.append(top_level_key) - if line.startswith("["): + if line.count("=") >= 1 and not line.startswith("# "): + key = line.split("=")[0] + key = key.strip(" #") + parts = key.split(".") + if len(parts) > 1: + cur_section = parts[0] + if cur_section not in sections: + sections[cur_section] = ["[" + cur_section + "]"] + section_order.append(cur_section) + elif cur_section is None: + top_level_keys.append(key) + # put the comment lines within the start of + # a new section, not outside it. + sections[cur_section] += comment_lines + comment_lines = [] + # remove just the `section.` part from the line, if present. + sections[cur_section].append( + re.sub("(#?)([a-zA-Z_-]+\\.)?(.*)", "\\1\\3", line) + ) + elif line.startswith("["): cur_section = line[1:-1] if cur_section.startswith("target"): cur_section = "target" @@ -605,8 +621,9 @@ def parse_example_config(known_args, config): sections[cur_section] = [line] section_order.append(cur_section) else: - sections[cur_section].append(line) + comment_lines.append(line) + sections[cur_section] += comment_lines # Fill out the `targets` array by giving all configured targets a copy of the # `target` section we just loaded from the example config configured_targets = [build(known_args)] |
