diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-03-25 18:22:52 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-03-27 00:39:45 +0300 |
commit | 9b2e533d87ad33c86b23869f2992c5882c8f6f6b (patch) | |
tree | 94ff3dfb5659757af6943a045ebdd293747b40ef /mesonbuild/mconf.py | |
parent | 977acc94b84077e84da7ddde4099e96f03530038 (diff) | |
download | meson-9b2e533d87ad33c86b23869f2992c5882c8f6f6b.zip meson-9b2e533d87ad33c86b23869f2992c5882c8f6f6b.tar.gz meson-9b2e533d87ad33c86b23869f2992c5882c8f6f6b.tar.bz2 |
Always build parser objects anew to avoid leaking old data.
Diffstat (limited to 'mesonbuild/mconf.py')
-rw-r--r-- | mesonbuild/mconf.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index b409615..cadd306 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.') |