diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-10-04 21:19:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-04 21:19:39 +0300 |
commit | 577d6bfdb483452b2a9434ba3a1d7031094b0cbd (patch) | |
tree | 1dac74f6e858db7c896e033062a125ac2048aacd /mesonbuild/mesonlib.py | |
parent | 019a627f047667ea04574cebb9a174156b2a7a67 (diff) | |
parent | adae6b56de5d8dac7b2eddbb3b9924e440a28fd6 (diff) | |
download | meson-577d6bfdb483452b2a9434ba3a1d7031094b0cbd.zip meson-577d6bfdb483452b2a9434ba3a1d7031094b0cbd.tar.gz meson-577d6bfdb483452b2a9434ba3a1d7031094b0cbd.tar.bz2 |
Merge pull request #4204 from xclaesse/unify-cmd-line
Use a single ArgumentParser for all subcommands
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 8648a0d..33900b6 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -48,6 +48,23 @@ else: python_command = [sys.executable] meson_command = None +def set_meson_command(mainfile): + global python_command + global meson_command + # On UNIX-like systems `meson` is a Python script + # On Windows `meson` and `meson.exe` are wrapper exes + if not mainfile.endswith('.py'): + meson_command = [mainfile] + elif os.path.isabs(mainfile) and mainfile.endswith('mesonmain.py'): + # Can't actually run meson with an absolute path to mesonmain.py, it must be run as -m mesonbuild.mesonmain + meson_command = python_command + ['-m', 'mesonbuild.mesonmain'] + else: + # Either run uninstalled, or full path to meson-script.py + meson_command = python_command + [mainfile] + # We print this value for unit tests. + if 'MESON_COMMAND_TESTS' in os.environ: + mlog.log('meson_command is {!r}'.format(meson_command)) + def is_ascii_string(astring): try: if isinstance(astring, str): |