summaryrefslogtreecommitdiff
path: root/mesonbuild/mconf.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/mconf.py
parentc4192a04fd3d46ac7a0ee81a158e7b1e3d4f06f8 (diff)
downloadmeson-parserbuilder.tar.gz
Always build parser objects anew to avoid leaking old data.parserbuilder
Diffstat (limited to 'mesonbuild/mconf.py')
-rw-r--r--mesonbuild/mconf.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index b40961561..cadd30667 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -17,13 +17,15 @@ import sys
import argparse
from . import (coredata, mesonlib, build)
-parser = argparse.ArgumentParser(prog='meson configure')
+def buildparser():
+ parser = argparse.ArgumentParser(prog='meson configure')
-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)')
+ 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)')
+ return parser
class ConfException(mesonlib.MesonException):
@@ -226,7 +228,7 @@ def run(args):
args = mesonlib.expand_arguments(args)
if not args:
args = [os.getcwd()]
- options = parser.parse_args(args)
+ options = buildparser().parse_args(args)
if len(options.directory) > 1:
print('%s <build directory>' % args[0])
print('If you omit the build directory, the current directory is substituted.')