Skip to content

Commit eab51fd

Browse files
More robust check that VIRUAL_ENV is valid
1 parent d8bc19e commit eab51fd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dpctl/_init_helper.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
# with DPC++ libraries to the DLL search path gh-1745
2323
if "VIRTUAL_ENV" in os.environ:
2424
venv_dir = os.environ["VIRTUAL_ENV"]
25-
expected_dir = os.path.join(venv_dir, "Library", "bin")
26-
if os.path.exists(expected_dir):
27-
os.add_dll_directory(expected_dir)
25+
# Expect to find file per PEP-0405
26+
expected_file = os.path.join(venv_dir, "pyvenv.cfg")
27+
dll_dir = os.path.join(venv_dir, "Library", "bin")
28+
if os.path.isdir(dll_dir) and os.path.isfile(expected_file):
29+
os.add_dll_directory(dll_dir)

0 commit comments

Comments
 (0)