Skip to content

Commit b1da38d

Browse files
committed
[WIP] Implement windows
Signed-off-by: Cristian Le <[email protected]>
1 parent cf1e401 commit b1da38d

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/scikit_build_core/repair_wheel/windows.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
from __future__ import annotations
66

7+
import shutil
78
from typing import TYPE_CHECKING
89

910
import delvewheel # noqa: F401
1011

12+
from .._logging import logger
1113
from . import WheelRepairer
1214

1315
if TYPE_CHECKING:
@@ -28,5 +30,32 @@ class WindowsWheelRepairer(WheelRepairer):
2830
_platform = "Windows"
2931

3032
def patch_target(self, target: Target) -> None:
31-
# TODO: Implement patching
32-
pass
33+
if target.type == "SHARED_LIBRARY":
34+
# Copy the dll files to the script install path
35+
# TODO: Actually this would be easier using the `installers`,
36+
# but that is CMake version dependent
37+
dll_artifact = next(
38+
artifact.path
39+
for artifact in target.artifacts
40+
if artifact.path.suffix == ".dll"
41+
)
42+
# Loop over all install paths, until we get to RUNTIME destination
43+
for install_path in self.get_wheel_install_paths(target):
44+
dll_file = install_path / dll_artifact
45+
if not dll_file.exists():
46+
continue
47+
# Do the copy
48+
shutil.copy(dll_file, self.wheel_dirs["scripts"])
49+
# We only need to copy the dll once
50+
break
51+
else:
52+
logger.warning(
53+
"Could not find {dll_artifact} to copy",
54+
dll_artifact=dll_artifact,
55+
)
56+
# TODO: Patch the python extension files
57+
58+
def repair_wheel(self) -> None:
59+
super().repair_wheel()
60+
# TODO: Patch python files using `delvewheel._wheel_repair.WheelRepair._patch_py_file`?
61+
# Shouldn't it be sufficient being in the global scripts dir?

0 commit comments

Comments
 (0)