configure: Fix bug in configure_top_level_key
Before, it only worked for numbers, not strings.
This commit is contained in:
parent
d7f9e81650
commit
6d07dbc266
@ -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()
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user