Rollup merge of #94819 - jonhoo:configure-empty-list, r=Mark-Simulacrum

configure: don't serialize empty array elements

Before this change:

    $ ./configure --codegen-backends=
    [..]
    $ grep -P '^codegen-backends' config.toml
    codegen-backends = ['']

After this change:

    $ ./configure --codegen-backends=
    [..]
    $ grep -P '^codegen-backends' config.toml
    codegen-backends = []
This commit is contained in:
Dylan DPC 2022-03-11 03:32:05 +01:00 committed by GitHub
commit bb8274ad36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -279,6 +279,10 @@ def build():
def set(key, value): def set(key, value):
if isinstance(value, list):
# Remove empty values, which value.split(',') tends to generate.
value = [v for v in value if v]
s = "{:20} := {}".format(key, value) s = "{:20} := {}".format(key, value)
if len(s) < 70: if len(s) < 70:
p(s) p(s)