summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
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):