Skip to content

ENH: correctly handle install_rpath when installing into wheels

Cirrus CI / debian-11 failed Feb 13, 2025 in 1m 59s

Task Summary

Instruction test failed in 01:57

Details

⚠️ Not enough compute credits to prioritize tasks!
ℹ️ Scheduling was delayed due to a concurrency limit on community tasks

✅ 00:00 clone
❌ 01:57 test

+ /usr/bin/ninja
[1/8] Compiling C object mypkg/libexamplelib.so.p/examplelib.c.o
[2/8] Compiling C object mypkg/sub/libexamplelib2.so.p/examplelib2.c.o
[3/8] Linking target mypkg/libexamplelib.so
[4/8] Linking target mypkg/sub/libexamplelib2.so
[5/8] Compiling C object mypkg/_example.cpython-39-x86_64-linux-gnu.so.p/_examplemod.c.o
[6/8] Generating symbol file mypkg/libexamplelib.so.p/libexamplelib.so.symbols
[7/8] Generating symbol file mypkg/sub/libexamplelib2.so.p/libexamplelib2.so.symbols
[8/8] Linking target mypkg/_example.cpython-39-x86_64-linux-gnu.so
[1/4] /tmp/cirrus-ci-build/tests/packages/sharedlib-in-package/.mesonpy-qcwamm8y/mypkg/libexamplelib.so
[2/4] /tmp/cirrus-ci-build/tests/packages/sharedlib-in-package/.mesonpy-qcwamm8y/mypkg/sub/libexamplelib2.so
[3/4] /tmp/cirrus-ci-build/tests/packages/sharedlib-in-package/.mesonpy-qcwamm8y/mypkg/_example.cpython-39-x86_64-linux-gnu.so
[4/4] /tmp/cirrus-ci-build/tests/packages/sharedlib-in-package/mypkg/__init__.py
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pytest-of-root/pytest-0/mesonpy-test-venv5/lib/python3.9/site-packages/mypkg/__init__.py", line 48, in <module>
    from ._example import example_prod, example_sum  #noqa: E402
ImportError: libexamplelib.so: cannot open shared object file: No such file or directory
__________________________________ test_rpath __________________________________

wheel_link_against_local_lib = PosixPath('/tmp/pytest-of-root/pytest-0/test0/mesonpy-test-jak4plgt/link_against_local_lib-1.0.0-cp39-cp39-linux_x86_64.whl')
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_rpath0')

    @pytest.mark.skipif(sys.platform in {'win32', 'cygwin'}, reason='requires RPATH support')
    def test_rpath(wheel_link_against_local_lib, tmp_path):
        artifact = wheel.wheelfile.WheelFile(wheel_link_against_local_lib)
        artifact.extractall(tmp_path)
    
        origin = '@loader_path' if sys.platform == 'darwin' else '$ORIGIN'
        expected = {f'{origin}/../.link_against_local_lib.mesonpy.libs', 'custom-rpath',}
    
        rpath = set(mesonpy._rpath._get_rpath(tmp_path / 'example' / f'_example{EXT_SUFFIX}'))
        # Verify that rpath is a superset of the expected one: linking to
        # the Python runtime may require additional rpath entries.
>       assert rpath >= expected
E       AssertionError: assert {'$ORIGIN/../...'h', 'm', ...} >= {'$ORIGIN/../...custom-rpath'}
E         
E         Extra items in the right set:
E         'custom-rpath'

tests/test_wheel.py:207: AssertionError
=========================== short test summary info ============================
SKIPPED [1] tests/test_project.py:333: requires MSVC
SKIPPED [3] tests/test_project.py:345: macOS specific test
SKIPPED [2] tests/test_project.py:362: macOS specific test
SKIPPED [1] tests/test_tags.py:47: macOS specific test
SKIPPED [1] tests/test_tags.py:59: macOS specific test
SKIPPED [1] tests/test_tags.py:69: macOS specific test
SKIPPED [2] tests/test_wheel.py:283: macOS specific test
FAILED tests/test_wheel.py::test_sharedlib_in_package - subprocess.CalledProcessError: Command '['/tmp/pytest-of-root/pytest-0/mesonpy-test-venv5/bin/python3', '-c', 'import mypkg; print(mypkg.example_sum(2, 5))']' returned non-zero exit status 1.
FAILED tests/test_wheel.py::test_rpath - AssertionError: assert {'$ORIGIN/../...'h', 'm', ...} >= {'$ORIGIN/../...custom-rpath'}
  
  Extra items in the right set:
  'custom-rpath'
============= 2 failed, 121 passed, 11 skipped in 98.38s (0:01:38) =============