aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-12-12 13:03:03 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-12-12 16:15:18 +0200
commitc66d4c144af78d6b0363f66bad8ae6e1147be194 (patch)
treecb20711f95430443e0baa032e7d8da9b837c2e99
parent131459bd05d8d5fbc118892872293704dd6f93a1 (diff)
downloadmeson-c66d4c144af78d6b0363f66bad8ae6e1147be194.zip
meson-c66d4c144af78d6b0363f66bad8ae6e1147be194.tar.gz
meson-c66d4c144af78d6b0363f66bad8ae6e1147be194.tar.bz2
Better Python exe detector. Closes #4614.
-rw-r--r--mesonbuild/scripts/commandrunner.py6
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:]