aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonmain.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-05-13 10:36:58 -0400
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-06-06 20:02:37 +0000
commit75e501ceb8888562b2749d20ba2c43374e5c9671 (patch)
tree48418eb4a15442f262fbe2a35477b14cf8c0e0ca /mesonbuild/mesonmain.py
parent8afbfe227bb4f8848865f95980d51caf569eeff9 (diff)
downloadmeson-75e501ceb8888562b2749d20ba2c43374e5c9671.zip
meson-75e501ceb8888562b2749d20ba2c43374e5c9671.tar.gz
meson-75e501ceb8888562b2749d20ba2c43374e5c9671.tar.bz2
coredata: Stop setting default option values as argparse attribute
All options are now the projectoptions list, regardless of how they got defined in the command line. This also delays setting builtin option values until the main project() default options are parsed to simplify the code. This is possible because we already delayed setting the backend after parsing main project() in a previous commit.
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r--mesonbuild/mesonmain.py22
1 files changed, 1 insertions, 21 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 50a8c7e..0d210c4 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -52,26 +52,6 @@ def wrapmodetype(string):
msg = 'invalid argument {!r}, use one of {}'.format(string, msg)
raise argparse.ArgumentTypeError(msg)
-def filter_builtin_options(args, original_args):
- """Filter out any builtin arguments passed as -D options.
-
- Error if an argument is passed with -- and -D
- """
- arguments = dict(p.split('=', 1) for p in args.projectoptions)
- meson_opts = set(arguments).intersection(set(coredata.builtin_options))
- if meson_opts:
- for arg in meson_opts:
- value = arguments[arg]
- cmdline_name = coredata.get_builtin_option_cmdline_name(arg)
- if any([a.startswith(cmdline_name) for a in original_args]):
- raise MesonException(
- 'Argument "{0}" passed as both {1} and -D{0}, but only '
- 'one is allowed'.format(arg, cmdline_name))
- setattr(args, arg, value)
-
- # Remove the builtin option from the project args values
- args.projectoptions.remove('{}={}'.format(arg, value))
-
class MesonApp:
def __init__(self, dir1, dir2, handshake, options, original_cmd_line_args):
@@ -334,7 +314,7 @@ def run(original_args, mainfile):
args = mesonlib.expand_arguments(args)
options = parser.parse_args(args)
- filter_builtin_options(options, args)
+ coredata.parse_cmd_line_options(options)
args = options.directories
if not args or len(args) > 2:
# if there's a meson.build in the dir above, and not in the current