spack.detection package¶
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
- 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.Package) – package for which Program Files location is to be computed
- 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.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.
- 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.
- spack.detection.path.executables_in_path(path_hints=None)[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_library_path(path_hints=None)[source]¶
Get the paths of all libraries available from LD_LIBRARY_PATH, LIBRARY_PATH, DYLD_LIBRARY_PATH, and DYLD_FALLBACK_LIBRARY_PATH.
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.
Module contents¶
- 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.
- 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.
- 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=None)[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.