aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mconf.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-05-13 10:36:58 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2018-10-04 09:40:21 -0400
commit37067a53c4b3b99982ef8e1f431ba0c9302b66e8 (patch)
tree7d3ebbb24b45bf6cfdb2a76a4dcdabf8808a346c /mesonbuild/mconf.py
parent5af2717e76015b47bfc2b11d4034099d9b62d978 (diff)
downloadmeson-37067a53c4b3b99982ef8e1f431ba0c9302b66e8.zip
meson-37067a53c4b3b99982ef8e1f431ba0c9302b66e8.tar.gz
meson-37067a53c4b3b99982ef8e1f431ba0c9302b66e8.tar.bz2
Use a single ArgumentParser for all subcommands
This has the adventage that "meson --help" shows a list of all commands, making them discoverable. This also reduce the manual parsing of arguments to the strict minimum needed for backward compatibility.
Diffstat (limited to 'mesonbuild/mconf.py')
-rw-r--r--mesonbuild/mconf.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index 2fd69b0..576c574 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -13,17 +13,13 @@
# limitations under the License.
import os
-import argparse
from . import (coredata, mesonlib, build)
-def buildparser():
- parser = argparse.ArgumentParser(prog='meson configure')
+def add_arguments(parser):
coredata.register_builtin_arguments(parser)
-
parser.add_argument('builddir', nargs='?', default='.')
parser.add_argument('--clearcache', action='store_true', default=False,
help='Clear cached state (e.g. found dependencies)')
- return parser
class ConfException(mesonlib.MesonException):
@@ -149,9 +145,7 @@ class Conf:
self.print_options('Testing options', test_options)
-def run(args):
- args = mesonlib.expand_arguments(args)
- options = buildparser().parse_args(args)
+def run(options):
coredata.parse_cmd_line_options(options)
builddir = os.path.abspath(os.path.realpath(options.builddir))
try: