From ac4f8d0088e7be5fc37f4611a7fadb2361c945f2 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 23 Feb 2022 11:27:03 -0500 Subject: [PATCH] devenv: Do not prepend empty list to PATH and LD_LIBRARY_PATH --- mesonbuild/backend/backends.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 1bb775d7c..dae9c4702 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1834,11 +1834,13 @@ class Backend: # LD_LIBRARY_PATH. This allows running system applications using # that library. library_paths.add(tdir) - if mesonlib.is_windows() or mesonlib.is_cygwin(): - extra_paths.update(library_paths) - elif mesonlib.is_osx(): - env.prepend('DYLD_LIBRARY_PATH', list(library_paths)) - else: - env.prepend('LD_LIBRARY_PATH', list(library_paths)) - env.prepend('PATH', list(extra_paths)) + if library_paths: + if mesonlib.is_windows() or mesonlib.is_cygwin(): + extra_paths.update(library_paths) + elif mesonlib.is_osx(): + env.prepend('DYLD_LIBRARY_PATH', list(library_paths)) + else: + env.prepend('LD_LIBRARY_PATH', list(library_paths)) + if extra_paths: + env.prepend('PATH', list(extra_paths)) return env