spack.detection package

class spack.detection.DetectedPackage(spec, prefix)

Bases: tuple

Information on a package that has been detected

property prefix

Alias for field number 1

property spec

Alias for field number 0

spack.detection.by_executable(packages_to_check, path_hints=None)[source]

Return the list of packages that have been detected on the system, searching by path.

Parameters
  • packages_to_check (list) – list of package classes to be detected

  • path_hints (list) – list of paths to be searched. If None the list will be constructed based on the PATH environment variable.

spack.detection.by_library(packages_to_check, path_hints=None)[source]

Return the list of packages that have been detected on the system, searching by LD_LIBRARY_PATH, LIBRARY_PATH, DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, and standard system library paths.

Parameters
  • packages_to_check (list) – list of packages to be detected

  • path_hints (list) – list of paths to be searched. If None the list will be constructed based on the LD_LIBRARY_PATH, LIBRARY_PATH, DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH environment variables and standard system library paths.

spack.detection.executable_prefix(executable_dir)[source]

Given a directory where an executable is found, guess the prefix (i.e. the “root” directory of that installation) and return it.

Parameters

executable_dir – directory where an executable is found

spack.detection.executables_in_path(path_hints)[source]

Get the paths of all executables available from the current PATH.

For convenience, this is constructed as a dictionary where the keys are the executable paths and the values are the names of the executables (i.e. the basename of the executable path).

There may be multiple paths with the same basename. In this case it is assumed there are two different instances of the executable.

Parameters

path_hints (list) – list of paths to be searched. If None the list will be constructed based on the PATH environment variable.

spack.detection.update_configuration(detected_packages, scope=None, buildable=True)[source]

Add the packages passed as arguments to packages.yaml

Parameters
  • detected_packages (list) – list of DetectedPackage objects to be added

  • scope (str) – configuration scope where to add the detected packages

  • buildable (bool) – whether the detected packages are buildable or not

Submodules

spack.detection.common module

Define a common data structure to represent external packages and a function to update packages.yaml given a list of detected packages.

Ideally, each detection method should be placed in a specific subpackage and implement at least a function that returns a list of DetectedPackage objects. The update in packages.yaml can then be done using the function provided here.

The module also contains other functions that might be useful across different detection mechanisms.

class spack.detection.common.DetectedPackage(spec, prefix)

Bases: tuple

Information on a package that has been detected

property prefix

Alias for field number 1

property spec

Alias for field number 0

class spack.detection.common.WindowsCompilerExternalPaths[source]

Bases: object

static find_windows_compiler_bundled_packages()[source]

Return all MSVC compiler bundled packages

static find_windows_compiler_cmake_paths()[source]

Semi hard-coded search path for cmake bundled with MSVC

static find_windows_compiler_ninja_paths()[source]

Semi hard-coded search heuristic for locating ninja bundled with MSVC

static find_windows_compiler_root_paths()[source]

Helper for Windows compiler installation root discovery

At the moment simply returns location of VS install paths from VSWhere But should be extended to include more information as relevant

class spack.detection.common.WindowsKitExternalPaths[source]

Bases: object

static find_windows_driver_development_kit_paths()[source]

Provides a list of all installation paths for the WDK by version and architecture

static find_windows_kit_bin_paths(kit_base=None)[source]

Returns Windows kit bin directory per version

static find_windows_kit_lib_paths(kit_base=None)[source]

Returns Windows kit lib directory per version

static find_windows_kit_reg_installed_roots_paths()[source]
static find_windows_kit_reg_sdk_paths()[source]
static find_windows_kit_roots()[source]

Return Windows kit root, typically %programfiles%Windows Kits10|11

spack.detection.common.compute_windows_program_path_for_package(pkg)[source]

Given a package, attempt to compute its Windows program files location, return list of best guesses

Parameters

pkg (spack.package_base.PackageBase) – package for which Program Files location is to be computed

spack.detection.common.compute_windows_user_path_for_package(pkg)[source]

Given a package attempt to compute its user scoped install location, return list of potential locations based on common heuristics. For more info on Windows user specific installs see: https://learn.microsoft.com/en-us/dotnet/api/system.environment.specialfolder?view=netframework-4.8

spack.detection.common.executable_prefix(executable_dir)[source]

Given a directory where an executable is found, guess the prefix (i.e. the “root” directory of that installation) and return it.

Parameters

executable_dir – directory where an executable is found

spack.detection.common.find_win32_additional_install_paths()[source]

Not all programs on Windows live on the PATH Return a list of other potential install locations.

spack.detection.common.is_executable(file_path)[source]

Return True if the path passed as argument is that of an executable

spack.detection.common.library_prefix(library_dir)[source]

Given a directory where an library is found, guess the prefix (i.e. the “root” directory of that installation) and return it.

Parameters

library_dir – directory where an library is found

spack.detection.common.path_to_dict(search_paths)[source]

Return dictionary[fullpath]: basename from list of paths

spack.detection.common.update_configuration(detected_packages, scope=None, buildable=True)[source]

Add the packages passed as arguments to packages.yaml

Parameters
  • detected_packages (list) – list of DetectedPackage objects to be added

  • scope (str) – configuration scope where to add the detected packages

  • buildable (bool) – whether the detected packages are buildable or not

spack.detection.path module

Detection of software installed in the system based on paths inspections and running executables.

spack.detection.path.by_executable(packages_to_check, path_hints=None)[source]

Return the list of packages that have been detected on the system, searching by path.

Parameters
  • packages_to_check (list) – list of package classes to be detected

  • path_hints (list) – list of paths to be searched. If None the list will be constructed based on the PATH environment variable.

spack.detection.path.by_library(packages_to_check, path_hints=None)[source]

Return the list of packages that have been detected on the system, searching by LD_LIBRARY_PATH, LIBRARY_PATH, DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, and standard system library paths.

Parameters
  • packages_to_check (list) – list of packages to be detected

  • path_hints (list) – list of paths to be searched. If None the list will be constructed based on the LD_LIBRARY_PATH, LIBRARY_PATH, DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH environment variables and standard system library paths.

spack.detection.path.common_windows_package_paths()[source]
spack.detection.path.executables_in_path(path_hints)[source]

Get the paths of all executables available from the current PATH.

For convenience, this is constructed as a dictionary where the keys are the executable paths and the values are the names of the executables (i.e. the basename of the executable path).

There may be multiple paths with the same basename. In this case it is assumed there are two different instances of the executable.

Parameters

path_hints (list) – list of paths to be searched. If None the list will be constructed based on the PATH environment variable.

spack.detection.path.libraries_in_ld_and_system_library_path(path_hints=None)[source]

Get the paths of all libraries available from LD_LIBRARY_PATH, LIBRARY_PATH, DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, and standard system library paths.

For convenience, this is constructed as a dictionary where the keys are the library paths and the values are the names of the libraries (i.e. the basename of the library path).

There may be multiple paths with the same basename. In this case it is assumed there are two different instances of the library.

Parameters

path_hints (list) – list of paths to be searched. If None the list will be constructed based on the set of LD_LIBRARY_PATH, LIBRARY_PATH, DYLD_LIBRARY_PATH, and DYLD_FALLBACK_LIBRARY_PATH environment variables as well as the standard system library paths.

spack.detection.path.libraries_in_windows_paths(path_hints)[source]