diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-12-12 13:03:03 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-12-12 16:15:18 +0200 |
commit | c66d4c144af78d6b0363f66bad8ae6e1147be194 (patch) | |
tree | cb20711f95430443e0baa032e7d8da9b837c2e99 | |
parent | 131459bd05d8d5fbc118892872293704dd6f93a1 (diff) | |
download | meson-c66d4c144af78d6b0363f66bad8ae6e1147be194.zip meson-c66d4c144af78d6b0363f66bad8ae6e1147be194.tar.gz meson-c66d4c144af78d6b0363f66bad8ae6e1147be194.tar.bz2 |
Better Python exe detector. Closes #4614.
-rw-r--r-- | mesonbuild/scripts/commandrunner.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/scripts/commandrunner.py b/mesonbuild/scripts/commandrunner.py index fc65e5b..3807114 100644 --- a/mesonbuild/scripts/commandrunner.py +++ b/mesonbuild/scripts/commandrunner.py @@ -16,6 +16,7 @@ what to run, sets up the environment and executes the command.""" import sys, os, subprocess, shutil, shlex +import re def run_command(source_dir, build_dir, subdir, meson_command, command, arguments): env = {'MESON_SOURCE_ROOT': source_dir, @@ -49,6 +50,9 @@ def run_command(source_dir, build_dir, subdir, meson_command, command, arguments print('Could not execute command "{}": {}'.format(command, err)) sys.exit(1) +def is_python_command(cmdname): + end_py_regex = r'python(3|3\.\d+)?(\.exe)?$' + return re.search(end_py_regex, cmdname) is not None def run(args): if len(args) < 4: @@ -58,7 +62,7 @@ def run(args): build_dir = args[1] subdir = args[2] meson_command = args[3] - if 'python' in meson_command: # Hack. + if is_python_command(meson_command): meson_command = [meson_command, args[4]] command = args[5] arguments = args[6:] |