From 3bfbf9972ab0ee17b714387dca5d2cd6c6557f74 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 11 Sep 2019 18:38:05 +0200 Subject: [PATCH] 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!). See: https://mesonbuild.com/Run-targets.html --- tools/meson_install_subdir.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/meson_install_subdir.py b/tools/meson_install_subdir.py index 2118309f82..da220db1b2 100755 --- a/tools/meson_install_subdir.py +++ b/tools/meson_install_subdir.py @@ -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 ?')