perl/Module-Build-Tiny: update to 0.051 for Perl 5.36 and 5.38
[oi-userland.git] / components / python / meson-python / patches / 01-rpath.patch
blobea2ad60960b935ca32b82b102c347efa587513e1
1 https://github.com/mesonbuild/meson-python/pull/702
3 --- meson_python-0.17.1/mesonpy/_rpath.py.orig
4 +++ meson_python-0.17.1/mesonpy/_rpath.py
5 @@ -58,6 +58,31 @@
6 if path.startswith('@loader_path/'):
7 _replace_rpath(filepath, path, '@loader_path/' + libs_relative_path)
9 +elif sys.platform == 'sunos5':
11 + def _get_rpath(filepath: Path) -> List[str]:
12 + rpath = []
13 + r = subprocess.run(['/usr/bin/elfedit', '-r', '-e', 'dyn:rpath', os.fspath(filepath)], capture_output=True, check=True, text=True)
14 + for line in [x.split() for x in r.stdout.split('\n')]:
15 + if len(line) >= 4 and line[1] in ['RPATH', 'RUNPATH']:
16 + for path in line[3].split(':'):
17 + if not path in rpath:
18 + rpath.append(path)
19 + return rpath
21 + def _set_rpath(filepath: Path, rpath: Iterable[str]) -> None:
22 + subprocess.run(['/usr/bin/elfedit', '-e', 'dyn:rpath ' + ':'.join(rpath), os.fspath(filepath)], check=True)
24 + def fix_rpath(filepath: Path, libs_relative_path: str) -> None:
25 + old_rpath = _get_rpath(filepath)
26 + new_rpath = []
27 + for path in old_rpath:
28 + if path.startswith('$ORIGIN/'):
29 + path = '$ORIGIN/' + libs_relative_path
30 + new_rpath.append(path)
31 + if new_rpath != old_rpath:
32 + _set_rpath(filepath, new_rpath)
34 else:
36 def fix_rpath(filepath: Path, libs_relative_path: str) -> None:
37 --- meson_python-0.17.1/tests/test_wheel.py.orig
38 +++ meson_python-0.17.1/tests/test_wheel.py
39 @@ -140,7 +140,7 @@
40 assert artifact.read('license_file-1.0.0.dist-info/LICENSE.custom').rstrip() == b'Hello!'
43 -@pytest.mark.skipif(sys.platform not in {'linux', 'darwin'}, reason='Not supported on this platform')
44 +@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform')
45 def test_contents(package_library, wheel_library):
46 artifact = wheel.wheelfile.WheelFile(wheel_library)
48 @@ -154,19 +154,19 @@
52 -@pytest.mark.skipif(sys.platform not in {'linux', 'darwin'}, reason='Not supported on this platform')
53 +@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform')
54 def test_local_lib(venv, wheel_link_against_local_lib):
55 venv.pip('install', wheel_link_against_local_lib)
56 output = venv.python('-c', 'import example; print(example.example_sum(1, 2))')
57 assert int(output) == 3
60 -@pytest.mark.skipif(sys.platform not in {'linux', 'darwin'}, reason='Not supported on this platform')
61 +@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform')
62 def test_rpath(wheel_link_against_local_lib, tmp_path):
63 artifact = wheel.wheelfile.WheelFile(wheel_link_against_local_lib)
64 artifact.extractall(tmp_path)
66 - origin = {'linux': '$ORIGIN', 'darwin': '@loader_path'}[sys.platform]
67 + origin = {'linux': '$ORIGIN', 'darwin': '@loader_path', 'sunos5': '$ORIGIN'}[sys.platform]
68 expected = {f'{origin}/.link_against_local_lib.mesonpy.libs', 'custom-rpath',}
70 rpath = set(mesonpy._rpath._get_rpath(tmp_path / f'example{EXT_SUFFIX}'))
71 @@ -175,19 +175,19 @@
72 assert rpath >= expected
75 -@pytest.mark.skipif(sys.platform not in {'linux', 'darwin'}, reason='Not supported on this platform')
76 +@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform')
77 def test_uneeded_rpath(wheel_purelib_and_platlib, tmp_path):
78 artifact = wheel.wheelfile.WheelFile(wheel_purelib_and_platlib)
79 artifact.extractall(tmp_path)
81 - origin = {'linux': '$ORIGIN', 'darwin': '@loader_path'}[sys.platform]
82 + origin = {'linux': '$ORIGIN', 'darwin': '@loader_path', 'sunos5': '$ORIGIN'}[sys.platform]
84 rpath = mesonpy._rpath._get_rpath(tmp_path / f'plat{EXT_SUFFIX}')
85 for path in rpath:
86 assert origin not in path
89 -@pytest.mark.skipif(sys.platform not in {'linux', 'darwin'}, reason='Not supported on this platform')
90 +@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform')
91 def test_executable_bit(wheel_executable_bit):
92 artifact = wheel.wheelfile.WheelFile(wheel_executable_bit)