about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorAlex Huang <huangalex409@gmail.com>2023-03-03 17:27:29 -0500
committerAlex Huang <huangalex409@gmail.com>2023-03-03 17:27:29 -0500
commit00f98e6810f71fe306100dbd1ddba9666f22453b (patch)
tree8a0baf00c7a1937ecc86019505401418e5fc794e /src/bootstrap
parentf77bfb7336f21bfe6a5fb5f7358d4406e2597289 (diff)
downloadrust-00f98e6810f71fe306100dbd1ddba9666f22453b.tar.gz
rust-00f98e6810f71fe306100dbd1ddba9666f22453b.zip
./configure script should only show blocks (and associated comments) where it is not default
Diffstat (limited to 'src/bootstrap')
-rwxr-xr-xsrc/bootstrap/configure.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 04e798e3949..573d864600d 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -486,6 +486,22 @@ for section_key, section_config in config.items():
     else:
         configure_section(sections[section_key], section_config)
 
+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 l in block:
+                    f.write(l + "\n")
+            block = []
+            is_comment = True
+            continue
+        is_comment = is_comment and line.startswith('#')
+    return f
+
 # Now that we've built up our `config.toml`, write it all out in the same
 # order that we read it in.
 p("")
@@ -494,11 +510,9 @@ with bootstrap.output('config.toml') as f:
     for section in section_order:
         if section == 'target':
             for target in targets:
-                for line in targets[target]:
-                    f.write(line + "\n")
+                f = write_uncommented(targets[target], f)
         else:
-            for line in sections[section]:
-                f.write(line + "\n")
+            f = write_uncommented(sections[section], f)
 
 with bootstrap.output('Makefile') as f:
     contents = os.path.join(rust_dir, 'src', 'bootstrap', 'mk', 'Makefile.in')