diff options
author | Michael <michaelbrockus@gmail.com> | 2020-03-01 15:00:29 -0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2020-03-02 13:50:58 -0500 |
commit | 2f080b1f2e9ca076d04af8c67d18004970a03658 (patch) | |
tree | b9e147d55ad4f6c2f4820bf785eab7da3a5992d8 /mesonbuild/minit.py | |
parent | 6e865fc08d0d13b3846d00e80c9f3ea090645fb8 (diff) | |
download | meson-2f080b1f2e9ca076d04af8c67d18004970a03658.tar.gz |
add -C to meson init
Diffstat (limited to 'mesonbuild/minit.py')
-rw-r--r-- | mesonbuild/minit.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/minit.py b/mesonbuild/minit.py index 85d4a0fca..2cb225c92 100644 --- a/mesonbuild/minit.py +++ b/mesonbuild/minit.py @@ -18,6 +18,8 @@ from pathlib import Path from enum import Enum import subprocess import shutil +import sys +import os import re from glob import glob from mesonbuild import mesonlib @@ -210,6 +212,7 @@ def add_arguments(parser): Meson project. ''' parser.add_argument("srcfiles", metavar="sourcefile", nargs="*", help="source files. default: all recognized files in current directory") + parser.add_argument('-C', default='.', dest='wd', help='directory to cd into before running') parser.add_argument("-n", "--name", help="project name. default: name of current directory") parser.add_argument("-e", "--executable", help="executable name. default: project name") parser.add_argument("-d", "--deps", help="dependencies, comma-separated") @@ -224,6 +227,10 @@ def run(options) -> int: ''' Here we generate the new Meson sample project. ''' + if not Path(options.wd).exists(): + sys.exit('Project source root directory not found. Run this command in build directory root.') + os.chdir(options.wd) + if not glob('*'): autodetect_options(options, sample=True) if not options.language: |