Skip to content

Commit c797ecb

Browse files
committed
[Debug] Check is setting PATH and os.add_dll_directory manually works
Signed-off-by: Cristian Le <[email protected]>
1 parent 452fab7 commit c797ecb

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/scikit_build_core/repair_wheel/windows.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def _skbuild_patch_dll_dir():
3838
import os
3939
import sysconfig
4040
41+
print("Patching os.add_dll_directory")
4142
os.add_dll_directory(sysconfig.get_path("scripts"))
4243
4344
_skbuild_patch_dll_dir()

tests/packages/repair_wheel/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ if(DO_MANUAL_REPAIR)
4646
import os
4747
import sysconfig
4848

49+
print("Patching os.add_dll_directory")
4950
os.add_dll_directory(sysconfig.get_path("scripts"))
5051
]])
5152
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py DESTINATION ".")

tests/packages/repair_wheel/python/repair_wheel/__main__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
import os
4+
import platform
35
import subprocess
46
import sys
57
from pathlib import Path
@@ -8,7 +10,17 @@
810
def run() -> None:
911
exe_path = Path(__file__).parent
1012
exe_path = next((exe_path / "bin").glob("main*"))
11-
sys.exit(subprocess.call([str(exe_path), *sys.argv[2:]]))
13+
env = os.environ.copy()
14+
if platform.system() == "Windows":
15+
import sysconfig
16+
17+
env["PATH"] = os.pathsep.join([sysconfig.get_path("scripts"), env["PATH"]])
18+
sys.exit(
19+
subprocess.call(
20+
[str(exe_path), *sys.argv[2:]],
21+
env=env,
22+
)
23+
)
1224

1325

1426
if __name__ == "__main__":

0 commit comments

Comments
 (0)