diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-04-26 21:49:00 -0400 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.com> | 2018-04-26 22:46:40 -0400 |
commit | cb5ad2f2114519e4009f7ee6fcab3ad40d971de2 (patch) | |
tree | cf2bb943b27e0f6b32e78430b24b30bde70d3dd2 /mesonbuild | |
parent | 3ad45ef94e3372b81b284d7edd21123376f63575 (diff) | |
download | meson-cb5ad2f2114519e4009f7ee6fcab3ad40d971de2.zip meson-cb5ad2f2114519e4009f7ee6fcab3ad40d971de2.tar.gz meson-cb5ad2f2114519e4009f7ee6fcab3ad40d971de2.tar.bz2 |
Remove duplicated definition of -D cmdline arg
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/coredata.py | 2 | ||||
-rw-r--r-- | mesonbuild/mconf.py | 10 | ||||
-rw-r--r-- | mesonbuild/mesonmain.py | 2 |
3 files changed, 6 insertions, 8 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 61ea2ef..83d30ed 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -437,6 +437,8 @@ def add_builtin_argument(p, name): def register_builtin_arguments(parser): for n in builtin_options: add_builtin_argument(parser, n) + parser.add_argument('-D', action='append', dest='projectoptions', default=[], metavar="option", + help='Set the value of an option, can be used several times to set multiple options.') builtin_options = { 'buildtype': [UserComboOption, 'Build type to use.', ['plain', 'debug', 'debugoptimized', 'release', 'minsize'], 'debug'], diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index fd4c141..48c0fe2 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -21,8 +21,6 @@ def buildparser(): parser = argparse.ArgumentParser(prog='meson configure') coredata.register_builtin_arguments(parser) - parser.add_argument('-D', action='append', default=[], dest='sets', - help='Set an option to the given value.') parser.add_argument('directory', nargs='*') parser.add_argument('--clearcache', action='store_true', default=False, help='Clear cached state (e.g. found dependencies)') @@ -35,10 +33,10 @@ def filter_builtin_options(args, original_args): if not arg.startswith('--') or arg == '--clearcache': continue name = arg.lstrip('--').split('=', 1)[0] - if any([a.startswith(name + '=') for a in args.sets]): + if any([a.startswith(name + '=') for a in args.projectoptions]): raise mesonlib.MesonException( 'Got argument {0} as both -D{0} and --{0}. Pick one.'.format(name)) - args.sets.append('{}={}'.format(name, getattr(args, name))) + args.projectoptions.append('{}={}'.format(name, getattr(args, name))) delattr(args, name) @@ -255,8 +253,8 @@ def run(args): try: c = Conf(builddir) save = False - if len(options.sets) > 0: - c.set_options(options.sets) + if len(options.projectoptions) > 0: + c.set_options(options.projectoptions) save = True elif options.clearcache: c.clear_cache() diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 613e953..cae59b4 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -30,8 +30,6 @@ def create_parser(): coredata.register_builtin_arguments(p) p.add_argument('--cross-file', default=None, help='File describing cross compilation environment.') - p.add_argument('-D', action='append', dest='projectoptions', default=[], metavar="option", - help='Set the value of an option, can be used several times to set multiple options.') p.add_argument('-v', '--version', action='version', version=coredata.version) # See the mesonlib.WrapMode enum for documentation |