Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mesonbuild/scripts/depfixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ def fix_rpath(fname: str, rpath_dirs_to_remove: T.Set[bytes], new_rpath: T.Union
# on non-mac platforms. That can be expensive on some Windows machines
# (up to 30ms), which is significant with --only-changed. For details, see:
# https://github.com/mesonbuild/meson/pull/6612#discussion_r378581401
if INSTALL_NAME_TOOL is False:
if system == 'darwin' and INSTALL_NAME_TOOL is False:
INSTALL_NAME_TOOL = bool(shutil.which('install_name_tool'))
if INSTALL_NAME_TOOL:
if isinstance(new_rpath, bytes):
Expand Down
11 changes: 11 additions & 0 deletions unittests/internaltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import mesonbuild.envconfig
import mesonbuild.environment
import mesonbuild.modules.gnome
import mesonbuild.scripts.depfixer
import mesonbuild.scripts.env2mfile
from mesonbuild import coredata
from mesonbuild.compilers.c import ClangCCompiler, GnuCCompiler
Expand Down Expand Up @@ -2233,3 +2234,13 @@ def expected_binaries(gnu_tuple: str) -> T.Dict[str, T.List[str]]:
self.assertEqual(actual.compile_args, expected.compile_args)
self.assertEqual(actual.link_args, expected.link_args)
self.assertEqual(actual.cmake, expected.cmake)

def test_depfixer_skips_install_name_tool_on_non_darwin(self) -> None:
with tempfile.NamedTemporaryFile(suffix='.so') as f:
f.write(b'not an elf file')
f.flush()
with mock.patch('mesonbuild.scripts.depfixer.INSTALL_NAME_TOOL', True), \
mock.patch('mesonbuild.scripts.depfixer.fix_darwin') as mock_fix_darwin:
mesonbuild.scripts.depfixer.fix_rpath(
f.name, set(), '', '', {}, system='linux', verbose=False)
mock_fix_darwin.assert_not_called()
Loading