|
18 | 18 | import os.path |
19 | 19 | import sys |
20 | 20 |
|
21 | | -is_venv_win32 = ( |
22 | | - sys.platform == "win32" |
23 | | - and sys.base_exec_prefix != sys.exec_prefix |
24 | | - and os.path.isfile(os.path.join(sys.exec_prefix, "pyvenv.cfg")) |
| 21 | +is_venv = sys.base_exec_prefix != sys.exec_prefix and os.path.isfile( |
| 22 | + os.path.join(sys.exec_prefix, "pyvenv.cfg") |
25 | 23 | ) |
26 | 24 |
|
27 | | -if is_venv_win32: # pragma: no cover |
28 | | - # For virtual environments on Windows, add folder |
29 | | - # with DPC++ libraries to the DLL search path gh-1745 |
30 | | - dll_dir = os.path.join(sys.exec_prefix, "Library", "bin") |
31 | | - if os.path.isdir(dll_dir): |
32 | | - os.add_dll_directory(dll_dir) |
33 | | - |
34 | | -del is_venv_win32 |
| 25 | +if sys.platform == "win32": # pragma: no cover |
| 26 | + # Include folder containing DPCTLSyclInterface.dll to search path |
| 27 | + os.add_dll_directory(os.path.dirname(__file__)) |
| 28 | + if is_venv: |
| 29 | + # For virtual environments on Windows, add folder |
| 30 | + # with DPC++ libraries to the DLL search path gh-1745 |
| 31 | + dll_dir = os.path.join(sys.exec_prefix, "Library", "bin") |
| 32 | + if os.path.isdir(dll_dir): |
| 33 | + os.add_dll_directory(dll_dir) |
| 34 | + os.environ["PATH"] = os.pathsep.join( |
| 35 | + [os.getenv("PATH", ""), dll_dir] |
| 36 | + ) |
| 37 | + |
| 38 | +del is_venv |
35 | 39 |
|
36 | 40 | is_linux = sys.platform.startswith("linux") |
37 | 41 |
|
|
0 commit comments