summaryrefslogtreecommitdiff
path: root/mesonbuild/mintro.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-03-25 18:22:52 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2018-03-25 18:22:52 +0300
commit6c3dd9bbdb4c59b2f20c208f411f073dcf6291f3 (patch)
tree3522fcae20e4a18960e1f48f6acfe52bcee6f586 /mesonbuild/mintro.py
parentc4192a04fd3d46ac7a0ee81a158e7b1e3d4f06f8 (diff)
downloadmeson-parserbuilder.tar.gz
Always build parser objects anew to avoid leaking old data.parserbuilder
Diffstat (limited to 'mesonbuild/mintro.py')
-rw-r--r--mesonbuild/mintro.py44
1 files changed, 23 insertions, 21 deletions
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 23e666c2e..74d26da21 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -26,26 +26,28 @@ import argparse
import sys, os
import pathlib
-parser = argparse.ArgumentParser(prog='meson introspect')
-parser.add_argument('--targets', action='store_true', dest='list_targets', default=False,
- help='List top level targets.')
-parser.add_argument('--installed', action='store_true', dest='list_installed', default=False,
- help='List all installed files and directories.')
-parser.add_argument('--target-files', action='store', dest='target_files', default=None,
- help='List source files for a given target.')
-parser.add_argument('--buildsystem-files', action='store_true', dest='buildsystem_files', default=False,
- help='List files that make up the build system.')
-parser.add_argument('--buildoptions', action='store_true', dest='buildoptions', default=False,
- help='List all build options.')
-parser.add_argument('--tests', action='store_true', dest='tests', default=False,
- help='List all unit tests.')
-parser.add_argument('--benchmarks', action='store_true', dest='benchmarks', default=False,
- help='List all benchmarks.')
-parser.add_argument('--dependencies', action='store_true', dest='dependencies', default=False,
- help='List external dependencies.')
-parser.add_argument('--projectinfo', action='store_true', dest='projectinfo', default=False,
- help='Information about projects.')
-parser.add_argument('builddir', nargs='?', help='The build directory')
+def buildparser():
+ parser = argparse.ArgumentParser(prog='meson introspect')
+ parser.add_argument('--targets', action='store_true', dest='list_targets', default=False,
+ help='List top level targets.')
+ parser.add_argument('--installed', action='store_true', dest='list_installed', default=False,
+ help='List all installed files and directories.')
+ parser.add_argument('--target-files', action='store', dest='target_files', default=None,
+ help='List source files for a given target.')
+ parser.add_argument('--buildsystem-files', action='store_true', dest='buildsystem_files', default=False,
+ help='List files that make up the build system.')
+ parser.add_argument('--buildoptions', action='store_true', dest='buildoptions', default=False,
+ help='List all build options.')
+ parser.add_argument('--tests', action='store_true', dest='tests', default=False,
+ help='List all unit tests.')
+ parser.add_argument('--benchmarks', action='store_true', dest='benchmarks', default=False,
+ help='List all benchmarks.')
+ parser.add_argument('--dependencies', action='store_true', dest='dependencies', default=False,
+ help='List external dependencies.')
+ parser.add_argument('--projectinfo', action='store_true', dest='projectinfo', default=False,
+ help='Information about projects.')
+ parser.add_argument('builddir', nargs='?', help='The build directory')
+ return parser
def determine_installed_path(target, installdata):
install_target = None
@@ -202,7 +204,7 @@ def list_projinfo(builddata):
def run(args):
datadir = 'meson-private'
- options = parser.parse_args(args)
+ options = buildparser().parse_args(args)
if options.builddir is not None:
datadir = os.path.join(options.builddir, datadir)
if not os.path.isdir(datadir):