Merge pull request #358 from tp-m/no-args

Try harder to infer build and source directories if called without arguments.
pull/395/merge
Jussi Pakkanen 9 years ago
commit 6f907dd4ab
  1. 7
      mesonbuild/mesonmain.py

@ -231,10 +231,17 @@ def run(mainfile, args):
return 0 return 0
args = options.directories args = options.directories
if len(args) == 0 or len(args) > 2: if len(args) == 0 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 len(args) == 0 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('{} <source directory> <build directory>'.format(sys.argv[0]))
print('If you omit either directory, the current directory is substituted.') print('If you omit either directory, the current directory is substituted.')
print('Run {} --help for more information.'.format(sys.argv[0])) print('Run {} --help for more information.'.format(sys.argv[0]))
return 1 return 1
else:
dir1 = args[0] dir1 = args[0]
if len(args) > 1: if len(args) > 1:
dir2 = args[1] dir2 = args[1]

Loading…
Cancel
Save