summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
author百地 希留耶 <65301509+KiruyaMomochi@users.noreply.github.com>2022-10-27 04:45:35 +0800
committerGitHub <noreply@github.com>2022-10-26 13:45:35 -0700
commit4ff8a6a9b703002db9f1c5a949a4b00c4978363d (patch)
tree0b318fd83b06175298062ffa0a6256e6e75c2c9d /lib
parent5d0ae001a1184a7cf4cea3e2043b39fcc278dae6 (diff)
downloadspack-4ff8a6a9b703002db9f1c5a949a4b00c4978363d.tar.gz
spack-4ff8a6a9b703002db9f1c5a949a4b00c4978363d.tar.bz2
spack-4ff8a6a9b703002db9f1c5a949a4b00c4978363d.tar.xz
spack-4ff8a6a9b703002db9f1c5a949a4b00c4978363d.zip
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/bootstrap.py8
-rw-r--r--lib/spack/spack/util/executable.py3
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/spack/spack/bootstrap.py b/lib/spack/spack/bootstrap.py
index 2e0f2614e7..d92609fdcd 100644
--- a/lib/spack/spack/bootstrap.py
+++ b/lib/spack/spack/bootstrap.py
@@ -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
diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py
index cd8ddef6de..6160b95266 100644
--- a/lib/spack/spack/util/executable.py
+++ b/lib/spack/spack/util/executable.py
@@ -10,6 +10,7 @@ import subprocess
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):