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.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.is_executable(file_path)[source]¶
Return True if the path passed as argument is that of an executable
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.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.
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.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.