Add command multiplexer to main Meson invoker.
@@ -263,11 +263,32 @@ def run_script_command(args):
return cmdfunc(cmdargs)
def run(mainfile, args):
- if sys.version_info < (3, 3):
- print('Meson works correctly only with python 3.3+.')
+ if sys.version_info < (3, 4):
+ print('Meson works correctly only with python 3.4+.')
print('You have python %s.' % sys.version)
print('Please update your environment')
return 1
+ if len(args) > 0:
+ # First check if we want to run a subcommand.
+ cmd_name = args[0]
+ remaining_args = args[1:]
+ if cmd_name == 'test':
+ return mtest.run(remaining_args)
+ elif cmd_name == 'setup':
+ args = remaining_args
+ # FALLTROUGH like it's 1972.
+ elif cmd_name == 'introspect':
+ return mintro.run(remaining_args)
+ elif cmd_name == 'test':
+ return mtest.run(remaining_args)
+ elif cmd_name == 'rewrite':
+ return rewriter.run(remaining_args)
+ elif cmd_name == 'configure':
+ return mconf.run(remaining_args)
+ elif cmd_name == 'wrap':
+ return wraptool.run(remaining_args)
+
+ # No special command? Do the basic setup/reconf.
if len(args) >= 2 and args[0] == '--internal':
if args[1] != 'regenerate':
script = args[1]
@@ -281,6 +302,7 @@ def run(mainfile, args):
handshake = True
else:
handshake = False
+
args = mesonlib.expand_arguments(args)
options = parser.parse_args(args)
args = options.directories
