From 6d07dbc266f74509ae78dc144780d6fad7c7ded9 Mon Sep 17 00:00:00 2001 From: jyn <github@jyn.dev> Date: Wed, 19 Apr 2023 08:25:00 -0500 Subject: [PATCH] configure: Fix bug in `configure_top_level_key` Before, it only worked for numbers, not strings. --- src/bootstrap/bootstrap_test.py | 7 +++---- src/bootstrap/configure.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/bootstrap_test.py b/src/bootstrap/bootstrap_test.py index 20bd71f06e9..6717eb21012 100644 --- a/src/bootstrap/bootstrap_test.py +++ b/src/bootstrap/bootstrap_test.py @@ -107,10 +107,9 @@ class GenerateAndParseConfig(unittest.TestCase): build = self.serialize_and_parse(["--set", "target.x86_64-unknown-linux-gnu.cc=gcc"]) self.assertEqual(build.get_toml("cc", section="target.x86_64-unknown-linux-gnu"), 'gcc') - # Uncomment when #108928 is fixed. - # def test_set_top_level(self): - # build = self.serialize_and_parse(["--set", "profile=compiler"]) - # self.assertEqual(build.get_toml("profile"), 'compiler') + def test_set_top_level(self): + build = self.serialize_and_parse(["--set", "profile=compiler"]) + self.assertEqual(build.get_toml("profile"), 'compiler') if __name__ == '__main__': SUITE = unittest.TestSuite() diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index abd28b4005d..5937d5a8cdd 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -475,7 +475,7 @@ def configure_section(lines, config): def configure_top_level_key(lines, top_level_key, value): for i, line in enumerate(lines): if line.startswith('#' + top_level_key + ' = ') or line.startswith(top_level_key + ' = '): - lines[i] = "{} = {}".format(top_level_key, value) + lines[i] = "{} = {}".format(top_level_key, to_toml(value)) return raise RuntimeError("failed to find config line for {}".format(top_level_key))