Skip to content

Commit

Permalink
use the correct platform-specific library search path for the xz exe
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Jun 9, 2018
1 parent 4f78bbe commit 34bd769
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/python/pants/fs/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 34bd769

Please sign in to comment.