mconf: Do not store dict keys for no reason

If a dict is empty it will evaluate to False
pull/3177/head
Sander Sweers 7 years ago
parent 84d382f963
commit 9d31c751b6
  1. 21
      mesonbuild/mconf.py

@ -138,22 +138,20 @@ class Conf:
'value': self.coredata.get_builtin_option(key), 'value': self.coredata.get_builtin_option(key),
'choices': coredata.get_builtin_option_choices(key)}) 'choices': coredata.get_builtin_option_choices(key)})
self.print_aligned(carr) self.print_aligned(carr)
bekeys = sorted(self.coredata.backend_options) if not self.coredata.backend_options:
if not bekeys:
print(' No backend options\n') print(' No backend options\n')
else: else:
bearr = [] bearr = []
for k in bekeys: for k in sorted(self.coredata.backend_options):
o = self.coredata.backend_options[k] o = self.coredata.backend_options[k]
bearr.append({'name': k, 'descr': o.description, 'value': o.value, 'choices': ''}) bearr.append({'name': k, 'descr': o.description, 'value': o.value, 'choices': ''})
self.print_aligned(bearr) self.print_aligned(bearr)
print('\nBase options:') print('\nBase options:')
okeys = sorted(self.coredata.base_options) if not self.coredata.base_options:
if not okeys:
print(' No base options\n') print(' No base options\n')
else: else:
coarr = [] coarr = []
for k in okeys: for k in sorted(self.coredata.base_options):
o = self.coredata.base_options[k] o = self.coredata.base_options[k]
coarr.append({'name': k, 'descr': o.description, 'value': o.value, 'choices': o.choices}) coarr.append({'name': k, 'descr': o.description, 'value': o.value, 'choices': o.choices})
self.print_aligned(coarr) self.print_aligned(coarr)
@ -164,12 +162,11 @@ class Conf:
for (lang, args) in self.coredata.external_link_args.items(): for (lang, args) in self.coredata.external_link_args.items():
print(' ' + lang + '_link_args', str(args)) print(' ' + lang + '_link_args', str(args))
print('\nCompiler options:') print('\nCompiler options:')
okeys = sorted(self.coredata.compiler_options) if not self.coredata.compiler_options:
if not okeys:
print(' No compiler options\n') print(' No compiler options\n')
else: else:
coarr = [] coarr = []
for k in okeys: for k in self.coredata.compiler_options:
o = self.coredata.compiler_options[k] o = self.coredata.compiler_options[k]
coarr.append({'name': k, 'descr': o.description, 'value': o.value, 'choices': ''}) coarr.append({'name': k, 'descr': o.description, 'value': o.value, 'choices': ''})
self.print_aligned(coarr) self.print_aligned(coarr)
@ -198,11 +195,9 @@ class Conf:
if not self.coredata.user_options: if not self.coredata.user_options:
print(' This project does not have any options') print(' This project does not have any options')
else: else:
options = self.coredata.user_options
keys = sorted(options)
optarr = [] optarr = []
for key in keys: for key in sorted(self.coredata.user_options):
opt = options[key] opt = self.coredata.user_options[key]
if (opt.choices is None) or (not opt.choices): if (opt.choices is None) or (not opt.choices):
# Zero length list or string # Zero length list or string
choices = '' choices = ''

Loading…
Cancel
Save