aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-04-12 09:52:50 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2022-04-13 21:10:32 +0300
commit3180c579f6034fa832c1c38a4b3f53eb713f4158 (patch)
tree680db0f3d55d4b88a8a514daace57189a5b561dc
parentd68a0651e4bf650219e1d504a72f18fec1e94d4d (diff)
downloadmeson-3180c579f6034fa832c1c38a4b3f53eb713f4158.zip
meson-3180c579f6034fa832c1c38a4b3f53eb713f4158.tar.gz
meson-3180c579f6034fa832c1c38a4b3f53eb713f4158.tar.bz2
mconf: Fix printing <inherited from main project> for yielding options
In print_options() k was a string instead of OptionKey, but self.yielding_options expects OptionKey. Not sure how this has not been catched by mypy. Fix by keeping k as OptionKey which makes self.yielding_options useless. Fixes: #9503
-rw-r--r--mesonbuild/mconf.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index 4fa2ec0..b3cae31 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -65,7 +65,6 @@ class Conf:
# XXX: is there a case where this can actually remain false?
self.has_choices = False
self.all_subprojects: T.Set[str] = set()
- self.yielding_options: T.Set[OptionKey] = set()
if os.path.isdir(os.path.join(self.build_dir, 'meson-private')):
self.build = build.load(self.build_dir)
@@ -150,16 +149,12 @@ class Conf:
for l in itertools.zip_longest(name, val, desc, fillvalue=''):
print('{:{widths[0]}} {:{widths[1]}} {}'.format(*l, widths=three_column))
- def split_options_per_subproject(self, options: 'coredata.KeyedOptionDictType') -> T.Dict[str, T.Dict[str, 'UserOption']]:
- result: T.Dict[str, T.Dict[str, 'UserOption']] = {}
+ def split_options_per_subproject(self, options: 'coredata.KeyedOptionDictType') -> T.Dict[str, 'coredata.KeyedOptionDictType']:
+ result: T.Dict[str, 'coredata.KeyedOptionDictType'] = {}
for k, o in options.items():
- subproject = k.subproject
if k.subproject:
- k = k.as_root()
- if o.yielding and k in options:
- self.yielding_options.add(k)
- self.all_subprojects.add(subproject)
- result.setdefault(subproject, {})[str(k)] = o
+ self.all_subprojects.add(k.subproject)
+ result.setdefault(k.subproject, {})[k] = o
return result
def _add_line(self, name: OptionKey, value, choices, descr) -> None:
@@ -219,9 +214,10 @@ class Conf:
self.add_title(title)
for k, o in sorted(options.items()):
printable_value = o.printable_value()
- if k in self.yielding_options:
+ root = k.as_root()
+ if o.yielding and k.subproject and root in self.coredata.options:
printable_value = '<inherited from main project>'
- self.add_option(k, o.description, printable_value, o.choices)
+ self.add_option(str(root), o.description, printable_value, o.choices)
def print_conf(self):
def print_default_values_warning():
@@ -270,8 +266,8 @@ class Conf:
self.print_options('Core options', host_core_options[''])
if show_build_options:
self.print_options('', build_core_options[''])
- self.print_options('Backend options', {str(k): v for k, v in self.coredata.options.items() if k.is_backend()})
- self.print_options('Base options', {str(k): v for k, v in self.coredata.options.items() if k.is_base()})
+ self.print_options('Backend options', {k: v for k, v in self.coredata.options.items() if k.is_backend()})
+ self.print_options('Base options', {k: v for k, v in self.coredata.options.items() if k.is_base()})
self.print_options('Compiler options', host_compiler_options.get('', {}))
if show_build_options:
self.print_options('', build_compiler_options.get('', {}))