Skip to content

Commit

Permalink
Ignores missing DLLs dir in CPython3Windows
Browse files Browse the repository at this point in the history
This dir can be missing in some Python distributions,
e.g. in the embeddable Python for Windows.

This fix prevents the error described in
pypa#2368

Also fixes tests that were broken by prev commit.
  • Loading branch information
reksar committed Jun 28, 2022
1 parent 963e7da commit d73ab12
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,15 @@ def host_python(cls, interpreter):

@classmethod
def dll_and_pyd(cls, interpreter):
folders = [Path(interpreter.system_executable).parent]

# May be missing on some Python hosts.
# See https://github.com/pypa/virtualenv/issues/2368
dll_folder = Path(interpreter.system_prefix) / "DLLs"
host_exe_folder = Path(interpreter.system_executable).parent
for folder in [host_exe_folder, dll_folder]:
if dll_folder.is_dir():
folders.append(dll_folder)

for folder in folders:
for file in folder.iterdir():
if file.suffix in (".pyd", ".dll"):
yield PathRefToDest(file, cls.to_bin)
Expand Down

0 comments on commit d73ab12

Please sign in to comment.