Skip to content

Commit b926772

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

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import platform
2+
3+
if platform.system() == "Windows":
4+
import os
5+
import sysconfig
6+
7+
if hasattr(os, "add_dll_directory"):
8+
os.add_dll_directory(sysconfig.get_path("scripts"))

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
@@ -9,7 +11,17 @@ def run() -> None:
911
exe_path = Path(__file__).parent
1012
exe_path = next((exe_path / "bin").glob("main*"))
1113
print(exe_path)
12-
sys.exit(subprocess.call([str(exe_path), *sys.argv[2:]]))
14+
env = os.environ
15+
if platform.system() == "Windows":
16+
import sysconfig
17+
18+
env["PATH"] = f"{sysconfig.get_path('scripts')}:{env['PATH']}"
19+
sys.exit(
20+
subprocess.call(
21+
[str(exe_path), *sys.argv[2:]],
22+
env=env,
23+
)
24+
)
1325

1426

1527
if __name__ == "__main__":

0 commit comments

Comments
 (0)