From bd7810d119dc58527cddb1a294fd1e2f5685a860 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Thu, 5 Sep 2024 16:56:50 +0300 Subject: [PATCH] Move configure option -A functionality to -D. --- mesonbuild/mconf.py | 10 +--------- mesonbuild/options.py | 1 - unittests/linuxliketests.py | 4 ++-- unittests/optiontests.py | 12 ++++++------ 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index 42028307b61b..a7cbd2b5e01b 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -48,8 +48,6 @@ def add_arguments(parser: 'argparse.ArgumentParser') -> None: help='Clear cached state (e.g. found dependencies)') parser.add_argument('--no-pager', action='store_false', dest='pager', help='Do not redirect output to a pager') - parser.add_argument('-A', action='append', dest='A', - help='Add a subproject option.') parser.add_argument('-U', action='append', dest='U', help='Remove a subproject option.') @@ -358,8 +356,6 @@ def print_augments(self) -> None: def has_option_flags(options: T.Any) -> bool: if options.cmd_line_options: return True - if options.A: - return True if hasattr(options, 'D') and options.D: return True if options.U: @@ -386,10 +382,6 @@ def run_impl(options: CMDOptions, builddir: str) -> int: save = False if has_option_flags(options): - if hasattr(options, 'A'): - A = options.A - else: - A = [] if hasattr(options, 'U'): U = options.U else: @@ -397,7 +389,7 @@ def run_impl(options: CMDOptions, builddir: str) -> int: 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, A, U) + save |= c.coredata.optstore.set_from_configure_command(all_D, U) coredata.update_cmd_line_file(builddir, options) if options.clearcache: c.clear_cache() diff --git a/mesonbuild/options.py b/mesonbuild/options.py index 93244a95474a..f998780bafa4 100644 --- a/mesonbuild/options.py +++ b/mesonbuild/options.py @@ -790,7 +790,6 @@ def get_value_for(self, name: 'T.Union[OptionKey, str]', subproject: T.Optional[ vobject, resolved_value = self.get_value_object_and_value_for(key) return resolved_value - def num_options(self): basic = len(self.options) build = len(self.build_options) if self.build_options else 0 diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py index 4f83942735be..5841a02841d8 100644 --- a/unittests/linuxliketests.py +++ b/unittests/linuxliketests.py @@ -1847,7 +1847,7 @@ def test_persp_options(self): self.check_has_flag(compdb, sub2src, '-O1') # Set subproject option to O2 - self.setconf(['-Dround=2', '-A', 'sub2:optimization=3']) + self.setconf(['-Dround=2', '-D', 'sub2:optimization=3']) compdb = self.get_compdb() self.check_has_flag(compdb, mainsrc, '-O1') self.check_has_flag(compdb, sub1src, '-O1') @@ -1861,7 +1861,7 @@ def test_persp_options(self): self.check_has_flag(compdb, sub2src, '-O2') # Set top level option to O3 - self.setconf(['-Dround=4', '-A:optimization=3']) + self.setconf(['-Dround=4', '-D:optimization=3']) compdb = self.get_compdb() self.check_has_flag(compdb, mainsrc, '-O3') self.check_has_flag(compdb, sub1src, '-O1') diff --git a/unittests/optiontests.py b/unittests/optiontests.py index a688a96b777c..7dad6f279c25 100644 --- a/unittests/optiontests.py +++ b/unittests/optiontests.py @@ -119,24 +119,24 @@ def test_augments(self): self.assertEqual(optstore.get_value_for(name, sub2_name), top_value) # First augment a subproject - optstore.set_from_configure_command([], [f'{sub_name}:{name}={aug_value}'], []) + optstore.set_from_configure_command([f'{sub_name}:{name}={aug_value}'], []) self.assertEqual(optstore.get_value_for(name), top_value) self.assertEqual(optstore.get_value_for(name, sub_name), aug_value) self.assertEqual(optstore.get_value_for(name, sub2_name), top_value) - optstore.set_from_configure_command([], [], [f'{sub_name}:{name}']) + optstore.set_from_configure_command([], [f'{sub_name}:{name}']) self.assertEqual(optstore.get_value_for(name), top_value) self.assertEqual(optstore.get_value_for(name, sub_name), top_value) self.assertEqual(optstore.get_value_for(name, sub2_name), top_value) # And now augment the top level option - optstore.set_from_configure_command([], [f':{name}={aug_value}'], []) + optstore.set_from_configure_command([f':{name}={aug_value}'], []) self.assertEqual(optstore.get_value_for(name, None), top_value) self.assertEqual(optstore.get_value_for(name, ''), aug_value) self.assertEqual(optstore.get_value_for(name, sub_name), top_value) self.assertEqual(optstore.get_value_for(name, sub2_name), top_value) - optstore.set_from_configure_command([], [], [f':{name}']) + optstore.set_from_configure_command([], [f':{name}']) self.assertEqual(optstore.get_value_for(name), top_value) self.assertEqual(optstore.get_value_for(name, sub_name), top_value) self.assertEqual(optstore.get_value_for(name, sub2_name), top_value) @@ -155,8 +155,8 @@ def test_augment_set_sub(self): ['c++98', 'c++11', 'c++14', 'c++17', 'c++20', 'c++23'], top_value) optstore.add_system_option(name, co) - optstore.set_from_configure_command([], [f'{sub_name}:{name}={aug_value}'], []) - optstore.set_from_configure_command([f'{sub_name}:{name}={set_value}'], [], []) + optstore.set_from_configure_command([f'{sub_name}:{name}={aug_value}'], []) + optstore.set_from_configure_command([f'{sub_name}:{name}={set_value}'], []) self.assertEqual(optstore.get_value_for(name), top_value) self.assertEqual(optstore.get_value_for(name, sub_name), set_value)