Windows: fix bootstrap and package install failure (#32942)

* Add patches for building clingo with MSVC
* Help python find clingo DLL
* If an executable is located in "C:\Program Files", Executable was
  running into issues with the extra space. This quotes the exe
  to ensure that it is treated as a single value.

Signed-off-by: Kiruya Momochi <65301509+KiruyaMomochi@users.noreply.github.com>
This commit is contained in:
百地 希留耶
2022-10-27 04:45:35 +08:00
committed by GitHub
parent 5d0ae001a1
commit 4ff8a6a9b7
5 changed files with 52 additions and 1 deletions

View File

@@ -91,6 +91,14 @@ def _try_import_from_store(module, query_spec, query_info=None):
os.path.join(candidate_spec.prefix, pkg.platlib),
] # type: list[str]
path_before = list(sys.path)
# Python 3.8+ on Windows does not search dependent DLLs in PATH,
# so we need to manually add it using os.add_dll_directory
# https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew
if sys.version_info[:2] >= (3, 8) and sys.platform == "win32":
if os.path.isdir(candidate_spec.prefix.bin):
os.add_dll_directory(candidate_spec.prefix.bin) # novermin
# NOTE: try module_paths first and last, last allows an existing version in path
# to be picked up and used, possibly depending on something in the store, first
# allows the bootstrap version to work when an incompatible version is in

View File

@@ -10,6 +10,7 @@
import sys
from six import string_types, text_type
from six.moves import shlex_quote
import llnl.util.tty as tty
@@ -333,7 +334,7 @@ def which(*args, **kwargs):
Executable: The first executable that is found in the path
"""
exe = which_string(*args, **kwargs)
return Executable(exe) if exe else None
return Executable(shlex_quote(exe)) if exe else None
class ProcessError(spack.error.SpackError):