Commit 3bfbf997 authored by Jehan's avatar Jehan

tools: fix install-* meson targets.

We should not rely on the current working directory, as it looks like
meson sets it to be the source directory (even when actually in the
build dir) when running custom target (so it fails).

Instead meson explicitly sets MESON_SOURCE_ROOT and MESON_BUILD_ROOT
environment variables for us. We should use these. This should work in
every cases (whether calling from the source or build dir).

Also removing the special-casing for a _build/ directory. This updated
version is generic and won't assume that you used some generic naming or
direct subdir under the source (even if many people might use this path
and name; I, for one, certainly don't!).

parent 035802c5
Pipeline #114062 passed with stages
in 10 minutes and 49 seconds
......@@ -34,15 +34,12 @@ class MesonStatus(metaclass = Singleton):
def get_build_dir(self):
self.buildroot = None
cwd = Path(os.getcwd())
# Set up by meson.
cwd = Path(os.environ['MESON_BUILD_ROOT'])
if (cwd / 'meson-info').exists():
self.buildroot = cwd
with cwd / '_build' as _build:
if (_build / 'meson-info').exists():
self.buildroot = _build
if self.buildroot is None:
print('Error: build directory was not detected. Are you in it ?')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment