From 34bd7693bf52b480f103223e145a0ac9144f8887 Mon Sep 17 00:00:00 2001 From: Daniel McClanahan <1305167+cosmicexplorer@users.noreply.github.com> Date: Fri, 8 Jun 2018 17:18:08 -0700 Subject: [PATCH] use the correct platform-specific library search path for the xz exe --- src/python/pants/fs/archive.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/python/pants/fs/archive.py b/src/python/pants/fs/archive.py index 02d40b26479..f13de7696f9 100644 --- a/src/python/pants/fs/archive.py +++ b/src/python/pants/fs/archive.py @@ -163,9 +163,17 @@ def _invoke_xz(self, xz_input_file): env = { # Isolate the path so we know we're using our provided version of xz. 'PATH': xz_bin_dir, - # Only allow our xz's lib directory to resolve the liblzma.{so,dylib} dependency at runtime. - 'LD_LIBRARY_PATH': self._xz_library_path, } + + # Only allow our xz's lib directory to resolve the liblzma.{so,dylib} dependency at runtime. + normalized_os_name = get_normalized_os_name() + if normalized_os_name == 'darwin': + env['DYLD_FALLBACK_LIBRARY_PATH'] = self._xz_library_path + elif normalized_os_name == 'linux': + env['LD_LIBRARY_PATH'] = self._xz_library_path + else: + raise self.XZArchiverError("Unrecognized platform: {}.".format(normalized_os_name)) + try: # Pipe stderr to our own stderr, but leave stdout open so we can yield it. process = subprocess.Popen(