Skip to content

Commit 6ca07c3

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

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_wheel.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,26 @@ 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+
187+
rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'mypkg' / f'_example{EXT_SUFFIX}'))
188+
# This RPATH entry should be removed by meson-python but it is not.
189+
build_rpath = {f'{origin}/../src'}
190+
assert rpath == {origin, *build_rpath}
191+
192+
rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'mypkg' / f'liblib{LIB_SUFFIX}'))
193+
# This RPATH entry should be removed by meson-python but it is not.
194+
build_rpath = {f'{origin}/'}
195+
assert rpath == {f'{origin}/sub', *build_rpath}
196+
197+
rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'mypkg' / 'sub' / f'libsublib{LIB_SUFFIX}'))
198+
assert rpath == {}
199+
180200

181201
def test_sharedlib_in_package(venv, wheel_sharedlib_in_package):
182202
venv.pip('install', wheel_sharedlib_in_package)

0 commit comments

Comments
 (0)