Skip to content

Commit 2977be9

Browse files
committed
TST: add another RPATH handling verification test
This shows that build RPATHs are not correctly stripped.
1 parent 723364e commit 2977be9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_wheel.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@ def test_local_lib(venv, wheel_link_against_local_lib):
177177
output = venv.python('-c', 'import example; print(example.example_sum(1, 2))')
178178
assert int(output) == 3
179179

180+
@pytest.mark.skipif(sys.platform in {'win32', 'cygwin'}, reason='requires RPATH support')
181+
def test_sharedlib_in_package_rpath(wheel_sharedlib_in_package, tmp_path):
182+
artifact = wheel.wheelfile.WheelFile(wheel_sharedlib_in_package)
183+
artifact.extractall(tmp_path)
184+
185+
origin = '@loader_path' if sys.platform == 'darwin' else '$ORIGIN'
186+
# This RPATH entry should be removed by meson-python but it is not.
187+
build_rpath = {f'{origin}/../src'}
188+
189+
rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'mypkg' / f'_example{EXT_SUFFIX}'))
190+
assert rpath == {origin, *build_rpath}
191+
192+
rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'mypkg' / 'liblib.so'))
193+
assert rpath == {f'{origin}/sub', *build_rpath}
194+
180195

181196
def test_sharedlib_in_package(venv, wheel_sharedlib_in_package):
182197
venv.pip('install', wheel_sharedlib_in_package)

0 commit comments

Comments
 (0)