Skip to content

Commit f428b0d

Browse files
committed
Implement linux
Signed-off-by: Cristian Le <git@lecris.dev>
1 parent 565dbfe commit f428b0d

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
@@ -7,10 +7,10 @@
77
import dataclasses
88
from typing import TYPE_CHECKING
99

10-
from .base import WheelRepairer
10+
from .rpath import RpathWheelRepairer
1111

1212
if TYPE_CHECKING:
13-
from ..file_api.model.codemodel import Target
13+
from pathlib import Path
1414

1515
__all__ = ["LinuxWheelRepairer"]
1616

@@ -20,13 +20,27 @@ def __dir__() -> list[str]:
2020

2121

2222
@dataclasses.dataclass
23-
class LinuxWheelRepairer(WheelRepairer):
23+
class LinuxWheelRepairer(RpathWheelRepairer):
2424
"""
2525
Adjust the RPATH with $ORIGIN.
2626
"""
2727

2828
_platform = "Linux"
29+
_origin_symbol = "$ORIGIN"
2930

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

0 commit comments

Comments
 (0)