Skip to content

Commit 202ddb8

Browse files
committed
Implement linux
Signed-off-by: Cristian Le <git@lecris.dev>
1 parent 46d0957 commit 202ddb8

File tree

1 file changed

+20
-6
lines changed
  • src/scikit_build_core/repair_wheel

1 file changed

+20
-6
lines changed

src/scikit_build_core/repair_wheel/linux.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
from typing import TYPE_CHECKING
88

9-
from . import WheelRepairer
9+
from .rpath import RpathWheelRepairer
1010

1111
if TYPE_CHECKING:
12-
from ..file_api.model.codemodel import Target
12+
from pathlib import Path
1313

1414
__all__ = ["LinuxWheelRepairer"]
1515

@@ -18,13 +18,27 @@ def __dir__() -> list[str]:
1818
return __all__
1919

2020

21-
class LinuxWheelRepairer(WheelRepairer):
21+
class LinuxWheelRepairer(RpathWheelRepairer):
2222
"""
2323
Adjust the RPATH with $ORIGIN.
2424
"""
2525

2626
_platform = "Linux"
27+
_origin_symbol = "$ORIGIN"
2728

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

0 commit comments

Comments
 (0)