Skip to content

Commit

Permalink
Revert "Windows: Improve Python 3.8+ module check on Windows"
Browse files Browse the repository at this point in the history
This reverts commit 99ad11b.

This breaks working setups in conda. It is either wrong or incomplete
and thus cannot be used.

Fixes #10737
  • Loading branch information
eli-schwartz authored and nirbheek committed Sep 2, 2022
1 parent fa99485 commit 67123be
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions mesonbuild/modules/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,22 +753,10 @@ def find_installation(self, state: 'ModuleState', args: T.Tuple[T.Optional[str]]
found_modules: T.List[str] = []
missing_modules: T.List[str] = []
if python.found() and want_modules:
# Python 3.8.x or later require add_dll_directory() to be called on Windows if
# the needed modules require external DLLs that are not bundled with the modules.
# Simplify things by calling add_dll_directory() on the paths in %PATH%
add_paths_cmd = ''
if hasattr(os, 'add_dll_directory'):
add_paths_cmds = []
paths = os.environ['PATH'].split(os.pathsep)
for path in paths:
if path != '' and os.path.isdir(path):
add_paths_cmds.append(f'os.add_dll_directory({path!r})')
add_paths_cmd = 'import os;' + ';'.join(reversed(add_paths_cmds)) + ';'

for mod in want_modules:
p, *_ = mesonlib.Popen_safe(
python.command +
['-c', f'{add_paths_cmd}import {mod}'])
['-c', f'import {mod}'])
if p.returncode != 0:
missing_modules.append(mod)
else:
Expand Down

0 comments on commit 67123be

Please sign in to comment.