aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 9e0508b..4e72600 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -36,12 +36,11 @@ def detect_meson_py_location():
# $ <mesontool> <args> (gets run from /usr/bin/<mesontool>)
in_path_exe = shutil.which(c_fname)
if in_path_exe:
- m_dir, c_fname = os.path.split(in_path_exe)
- # Special case: when run like "./meson.py <opts>",
- # we need to expand it out, because, for example,
- # "ninja test" will be run from a different directory.
- if m_dir == '.':
+ if not os.path.isabs(in_path_exe):
m_dir = os.getcwd()
+ c_fname = in_path_exe
+ else:
+ m_dir, c_fname = os.path.split(in_path_exe)
else:
m_dir = os.path.abspath(c_dir)