aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-11-26 21:37:55 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-11-27 01:35:27 +0200
commit4ca1e8638c3f2bc7411ddc930cc8c995c163bc1a (patch)
tree3c9f51b25ca4a7f1c1e97bc48e586e499e09d640 /mesonbuild/mesonlib.py
parentf70760a5108ac7802f5385fb5e7c15229bf5d5c8 (diff)
downloadmeson-4ca1e8638c3f2bc7411ddc930cc8c995c163bc1a.zip
meson-4ca1e8638c3f2bc7411ddc930cc8c995c163bc1a.tar.gz
meson-4ca1e8638c3f2bc7411ddc930cc8c995c163bc1a.tar.bz2
Fix running tests when there is a period in PATH.
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index b432bf3..686f7d9 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -32,6 +32,13 @@ def detect_meson_py_location():
# $ meson <args> (gets run from /usr/bin/meson)
in_path_exe = shutil.which(c_fname)
if in_path_exe:
+ # Special case: when run like "./meson.py <opts>" and user has
+ # period in PATH, we need to expand it out, because, for example,
+ # "ninja test" will be run from a different directory.
+ if '.' in os.environ['PATH'].split(':'):
+ p, f = os.path.split(in_path_exe)
+ if p == '' or p == '.':
+ return os.path.join(os.getcwd(), f)
return in_path_exe
# $ python3 ./meson.py <args>
if os.path.exists(c):
@@ -52,7 +59,6 @@ else:
python_command = [sys.executable]
meson_command = python_command + [detect_meson_py_location()]
-
# Put this in objects that should not get dumped to pickle files
# by accident.
import threading