Skip to content

Commit 9cd01a9

Browse files
committed
Implement linux
Signed-off-by: Cristian Le <[email protected]>
1 parent 1c5e595 commit 9cd01a9

File tree

1 file changed

+19
-8
lines changed
  • src/scikit_build_core/repair_wheel

1 file changed

+19
-8
lines changed

src/scikit_build_core/repair_wheel/linux.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
from typing import TYPE_CHECKING
88

9-
import auditwheel # noqa: F401
9+
from auditwheel.elfutils import elf_read_rpaths
10+
from auditwheel.patcher import Patchelf
1011

11-
from . import WheelRepairer
12+
from .rpath import RpathWheelRepairer
1213

1314
if TYPE_CHECKING:
14-
from ..file_api.model.codemodel import Target
15+
from pathlib import Path
1516

1617
__all__ = ["LinuxWheelRepairer"]
1718

@@ -20,13 +21,23 @@ def __dir__() -> list[str]:
2021
return __all__
2122

2223

23-
class LinuxWheelRepairer(WheelRepairer):
24+
class LinuxWheelRepairer(RpathWheelRepairer):
2425
"""
2526
Adjust the RPATH with $ORIGIN.
2627
"""
2728

2829
_platform = "Linux"
29-
30-
def patch_target(self, target: Target) -> None:
31-
# TODO: Implement patching
32-
pass
30+
_origin_symbol = "$ORIGIN"
31+
32+
def get_library_rpath(self, artifact: Path) -> list[str]:
33+
return [
34+
path
35+
for dt_rpaths in elf_read_rpaths(artifact).values()
36+
for path in dt_rpaths
37+
]
38+
39+
def patch_library_rpath(self, artifact: Path, rpaths: list[str]) -> None:
40+
final_rpaths = set(rpaths)
41+
if final_rpaths:
42+
patcher = Patchelf()
43+
patcher.set_rpath(artifact, ":".join(final_rpaths))

0 commit comments

Comments
 (0)