summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-05-09 11:58:53 +0200
committerEli Schwartz <eschwartz93@gmail.com>2025-05-15 02:05:18 -0400
commitd8defe8ecdc5bca03acc269c11afe9db7ed6d454 (patch)
tree3fa1fde31f8067a39d61083bcd3e7cdc83b99d4f
parent625184335f6898a573d7e24040d3e94bc9ab0c8e (diff)
downloadmeson-d8defe8ecdc5bca03acc269c11afe9db7ed6d454.tar.gz
mconf: extract option processing to CoreData.set_from_configure_command
Prepare to reuse the logic in "meson setup --reconfigure". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--mesonbuild/coredata.py7
-rw-r--r--mesonbuild/mconf.py6
2 files changed, 8 insertions, 5 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 4343f6996..238b1e8c8 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -412,6 +412,13 @@ class CoreData:
return option_object.validate_value(override)
return value
+ def set_from_configure_command(self, options: SharedCMDOptions) -> bool:
+ unset_opts = getattr(options, 'unset_opts', [])
+ all_D = options.projectoptions[:]
+ for keystr, valstr in options.cmd_line_options.items():
+ all_D.append(f'{keystr}={valstr}')
+ return self.optstore.set_from_configure_command(all_D, unset_opts)
+
def set_option(self, key: OptionKey, value, first_invocation: bool = False) -> bool:
dirty = False
try:
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index d03e6487e..6534a7c03 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -370,11 +370,7 @@ def run_impl(options: CMDOptions, builddir: str) -> int:
save = False
if has_option_flags(options):
- unset_opts = getattr(options, 'unset_opts', [])
- all_D = options.projectoptions[:]
- for keystr, valstr in options.cmd_line_options.items():
- all_D.append(f'{keystr}={valstr}')
- save |= c.coredata.optstore.set_from_configure_command(all_D, unset_opts)
+ save |= c.coredata.set_from_configure_command(options)
coredata.update_cmd_line_file(builddir, options)
if options.clearcache:
c.clear_cache()