Skip to content

Commit

Permalink
Windows: fix kit base path and reference to windows registry key (spa…
Browse files Browse the repository at this point in the history
…ck#41388)

* Proper handling of argument passed as semicolon-separated str
* Fix reference to windows registry key in win-wdk
  • Loading branch information
jamessmillie authored Dec 3, 2023
1 parent 88e738c commit 9e07202
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/spack/spack/detection/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,29 @@ def find_windows_kit_roots() -> List[str]:
return glob.glob(kit_base)

@staticmethod
def find_windows_kit_bin_paths(kit_base: Optional[str] = None) -> List[str]:
def find_windows_kit_bin_paths(
kit_base: Union[Optional[str], Optional[list]] = None
) -> List[str]:
"""Returns Windows kit bin directory per version"""
kit_base = WindowsKitExternalPaths.find_windows_kit_roots() if not kit_base else kit_base
assert kit_base, "Unexpectedly empty value for Windows kit base path"
if isinstance(kit_base, str):
kit_base = kit_base.split(";")
kit_paths = []
for kit in kit_base:
kit_bin = os.path.join(kit, "bin")
kit_paths.extend(glob.glob(os.path.join(kit_bin, "[0-9]*", "*\\")))
return kit_paths

@staticmethod
def find_windows_kit_lib_paths(kit_base: Optional[str] = None) -> List[str]:
def find_windows_kit_lib_paths(
kit_base: Union[Optional[str], Optional[list]] = None
) -> List[str]:
"""Returns Windows kit lib directory per version"""
kit_base = WindowsKitExternalPaths.find_windows_kit_roots() if not kit_base else kit_base
assert kit_base, "Unexpectedly empty value for Windows kit base path"
if isinstance(kit_base, str):
kit_base = kit_base.split(";")
kit_paths = []
for kit in kit_base:
kit_lib = os.path.join(kit, "Lib")
Expand Down
2 changes: 1 addition & 1 deletion var/spack/repos/builtin/packages/win-wdk/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def install(self, spec, prefix):
except ProcessError as pe:
reg = winreg.WindowsRegistryView(
"SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots",
root_key=spack.util.windows_registry.HKEY_LOCAL_MACHINE,
root_key=spack.util.windows_registry.HKEY.HKEY_LOCAL_MACHINE,
)
if not reg:
# No Kits are available, failure was genuine
Expand Down

0 comments on commit 9e07202

Please sign in to comment.