aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
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