diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-05-09 11:58:53 +0200 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-05-15 02:05:18 -0400 |
| commit | d8defe8ecdc5bca03acc269c11afe9db7ed6d454 (patch) | |
| tree | 3fa1fde31f8067a39d61083bcd3e7cdc83b99d4f | |
| parent | 625184335f6898a573d7e24040d3e94bc9ab0c8e (diff) | |
| download | meson-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.py | 7 | ||||
| -rw-r--r-- | mesonbuild/mconf.py | 6 |
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() |
