diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2019-08-06 10:09:19 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-08-07 22:57:02 +0300 |
commit | 7cc112df0d05369da93eeb267b2d877b77a3953b (patch) | |
tree | 3ed8548939212bb918023dd24d3e22ed7701b7f7 /mesonbuild/mdist.py | |
parent | 5fd4963766fe53d4a6db24a2cb7cb54e21600fe9 (diff) | |
download | meson-7cc112df0d05369da93eeb267b2d877b77a3953b.zip meson-7cc112df0d05369da93eeb267b2d877b77a3953b.tar.gz meson-7cc112df0d05369da93eeb267b2d877b77a3953b.tar.bz2 |
dist: Add '-C' option and print better error message
It was not obvious that 'meson dist' must be run from build directory.
Diffstat (limited to 'mesonbuild/mdist.py')
-rw-r--r-- | mesonbuild/mdist.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mesonbuild/mdist.py b/mesonbuild/mdist.py index 2d1aaf9..7b75382 100644 --- a/mesonbuild/mdist.py +++ b/mesonbuild/mdist.py @@ -22,8 +22,9 @@ import subprocess import hashlib import json from glob import glob +from pathlib import Path from mesonbuild.environment import detect_ninja -from mesonbuild.mesonlib import windows_proof_rmtree +from mesonbuild.mesonlib import windows_proof_rmtree, MesonException from mesonbuild import mlog, build archive_choices = ['gztar', 'xztar', 'zip'] @@ -32,6 +33,8 @@ archive_extension = {'gztar': '.tar.gz', 'zip': '.zip'} def add_arguments(parser): + parser.add_argument('-C', default='.', dest='wd', + help='directory to cd into before running') parser.add_argument('--formats', default='xztar', help='Comma separated list of archive types to create.') @@ -194,7 +197,11 @@ def determine_archives_to_generate(options): return result def run(options): - b = build.load('.') + options.wd = os.path.abspath(options.wd) + buildfile = Path(options.wd) / 'meson-private' / 'build.dat' + if not buildfile.is_file(): + raise MesonException('Directory {!r} does not seem to be a Meson build directory.'.format(options.wd)) + b = build.load(options.wd) # This import must be load delayed, otherwise it will get the default # value of None. from mesonbuild.mesonlib import meson_command |