-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
Summary
configure.py parses the bootstrap.example.toml file and writes out a bootstrap.toml based on the example template with values set using command line options like --set dist.vendor=false
The loop that writes the sections of the bootstrap.toml file accumulates the lines to be written for a given key (the comment lines prior to the key=value line, and the key=value line itself) and emits them when it reaches lines that belong to the next key. However when the loop finishes the section, it doesn't not emit any lines that have been accumulated that have not yet been emitted. Practically this means the last key=value pair in each section is never emitted.
Command used
python3 ./src/bootstrap/configure.py --set dist.vendor=falseExpected behaviour
bootstrap.toml contains
[dist]
# ...
vendor = falseActual behaviour
The [dist] section is empty
Bootstrap configuration (bootstrap.toml)
# Use different pre-set defaults than the global defaults.
#
# See `src/bootstrap/defaults` for more information.
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
profile = 'dist'
[llvm]
[gcc]
[build]
# Arguments passed to the `./configure` script, used during distcheck. You
# probably won't fill this in but rather it's filled in by the `./configure`
# script. Useful for debugging.
configure-args = ['--set', 'dist.vendor=false']
[install]
[rust]
[dist]
[target.aarch64-apple-darwin]Operating system
macOS, Linux
HEAD
Additional context
rust/src/bootstrap/configure.py
Lines 741 to 755 in 1b0bc59
| def write_uncommented(target, f): | |
| block = [] | |
| is_comment = True | |
| for line in target: | |
| block.append(line) | |
| if len(line) == 0: | |
| if not is_comment: | |
| for ln in block: | |
| f.write(ln + "\n") | |
| block = [] | |
| is_comment = True | |
| continue | |
| is_comment = is_comment and line.startswith("#") | |
| return f |