diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-05-13 10:36:58 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-06-06 20:02:37 +0000 |
commit | 7fbe10ac8d4c297b515145b319814a2f5caae60b (patch) | |
tree | 468aaf55e901a44ec0643e7e3647eabcde4c161a /mesonbuild/mesonmain.py | |
parent | 9350b9aa7bddd55c0857b3adeec0dfb8900f149c (diff) | |
download | meson-7fbe10ac8d4c297b515145b319814a2f5caae60b.zip meson-7fbe10ac8d4c297b515145b319814a2f5caae60b.tar.gz meson-7fbe10ac8d4c297b515145b319814a2f5caae60b.tar.bz2 |
mesonmain: Take only 2 optional directories
If only 1 dir is provided, the 2nd defaults to '.' and if none is
provided they default to '.' and '..'. It should be builddir first,
followed by sourcedir, but validate_core_dirs() will still swap them if
builddir contains a meson.build file.
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r-- | mesonbuild/mesonmain.py | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index facd3a3..e74fb36 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -41,7 +41,8 @@ def create_parser(): help='Special wrap mode to use') p.add_argument('--profile-self', action='store_true', dest='profile', help=argparse.SUPPRESS) - p.add_argument('directories', nargs='*') + p.add_argument('builddir', nargs='?', default='..') + p.add_argument('sourcedir', nargs='?', default='.') return p def wrapmodetype(string): @@ -314,24 +315,8 @@ def run(original_args, mainfile): args = mesonlib.expand_arguments(args) options = parser.parse_args(args) coredata.parse_cmd_line_options(options) - args = options.directories - if not args or len(args) > 2: - # if there's a meson.build in the dir above, and not in the current - # directory, assume we're in the build directory - if not args and not os.path.exists('meson.build') and os.path.exists('../meson.build'): - dir1 = '..' - dir2 = '.' - else: - print('{} <source directory> <build directory>'.format(sys.argv[0])) - print('If you omit either directory, the current directory is substituted.') - print('Run {} --help for more information.'.format(sys.argv[0])) - return 1 - else: - dir1 = args[0] - if len(args) > 1: - dir2 = args[1] - else: - dir2 = '.' + dir1 = options.builddir + dir2 = options.sourcedir try: app = MesonApp(dir1, dir2, handshake, options) except Exception as e: |