spack.cmd package¶
- exception spack.cmd.CommandNameError(name)[source]¶
Bases:
SpackErrorException class thrown for impermissible command names
- exception spack.cmd.CommandNotFoundError(cmd_name)[source]¶
Bases:
SpackErrorException class thrown when a requested command is not recognized as such.
- exception spack.cmd.MultipleSpecsMatch[source]¶
Bases:
ExceptionRaised when multiple specs match a constraint, in a context where this is not allowed.
- exception spack.cmd.NoSpecMatches[source]¶
Bases:
ExceptionRaised when no spec matches a constraint, in a context where this is not allowed.
- exception spack.cmd.PythonNameError(name)[source]¶
Bases:
SpackErrorException class thrown for impermissible python names
- spack.cmd.all_commands()[source]¶
Get a sorted list of all spack commands.
This will list the lib/spack/spack/cmd directory and find the commands there to construct the list. It does not actually import the python files – just gets the names.
- spack.cmd.disambiguate_spec(spec: Spec, env: Environment | None, local: bool = False, installed: bool | InstallRecordStatus = True, first: bool = False) Spec[source]¶
Given a spec, figure out which installed package it refers to.
- Parameters:
spec – a spec to disambiguate
env – a spack environment, if one is active, or None if no environment is active
local – do not search chained spack instances
installed – install status argument passed to database query.
first – returns the first matching spec, even if more than one match is found
- spack.cmd.disambiguate_spec_from_hashes(spec: Spec, hashes: List[str] | None, local: bool = False, installed: bool | InstallRecordStatus = True, first: bool = False) Spec[source]¶
Given a spec and a list of hashes, get concrete spec the spec refers to.
- Parameters:
spec – a spec to disambiguate
hashes – a set of hashes of specs among which to disambiguate
local – if True, do not search chained spack instances
installed – install status argument passed to database query.
first – returns the first matching spec, even if more than one match is found
- spack.cmd.display_specs(specs, args=None, **kwargs)[source]¶
Display human readable specs with customizable formatting.
Prints the supplied specs to the screen, formatted according to the arguments provided.
Specs are grouped by architecture and compiler, and columnized if possible.
Options can add more information to the default display. Options can be provided either as keyword arguments or as an argparse namespace. Keyword arguments take precedence over settings in the argparse namespace.
- Parameters:
specs (list) – the specs to display
args (argparse.Namespace or None) – namespace containing formatting arguments
- Keyword Arguments:
paths (bool) – Show paths with each displayed spec
deps (bool) – Display dependencies with specs
long (bool) – Display short hashes with specs
very_long (bool) – Display full hashes with specs (supersedes
long)namespaces (bool) – Print namespaces along with names
show_flags (bool) – Show compiler flags with specs
variants (bool) – Show variants with specs
indent (int) – indent each line this much
groups (bool) – display specs grouped by arch/compiler (default True)
decorator (Callable) – function to call to decorate specs
all_headers (bool) – show headers even when arch/compiler aren’t defined
status_fn (Callable) – if provided, prepend install-status info
output (IO) – A file object to write to. Default is
sys.stdoutspecfile_format (bool) – specfile format of the current spec
- spack.cmd.display_specs_as_json(specs, deps=False)[source]¶
Convert specs to a list of json records.
- spack.cmd.doc_dedented(function: object) str | None[source]¶
Return the docstring with leading indentation removed.
- spack.cmd.doc_first_line(function: object) str | None[source]¶
Return the first line of the docstring.
- spack.cmd.filter_loaded_specs(specs)[source]¶
Filter a list of specs returning only those that are currently loaded.
- spack.cmd.find_environment(args: Namespace) Environment | None[source]¶
Find active environment from args or environment variable.
Check for an environment in this order:
via
spack -e ENVorspack -D DIR(arguments)via a path in the spack.environment.spack_env_var environment variable.
If an environment is found, read it in. If not, return None.
- Parameters:
args – argparse namespace with command arguments
Returns: a found environment, or
None
- spack.cmd.get_command(cmd_name)[source]¶
Imports the command function associated with cmd_name.
The function’s name is derived from cmd_name using python_name().
- Parameters:
cmd_name (str) – name of the command (contains
-, not_).
- spack.cmd.get_module(cmd_name)[source]¶
Imports the module for a particular command name and returns it.
- Parameters:
cmd_name (str) – name of the command for which to get a module (contains
-, not_).
- spack.cmd.group_arguments(args: Sequence[str], *, max_group_size: int = 500, prefix_length: int = 0, max_group_length: int | None = None) Generator[List[str], None, None][source]¶
Splits the supplied list of arguments into groups for passing to CLI tools.
When passing CLI arguments, we need to ensure that argument lists are no longer than the system command line size limit, and we may also need to ensure that groups are no more than some number of arguments long.
This returns an iterator over lists of arguments that meet these constraints. Arguments are in the same order they appeared in the original argument list.
If any argument’s length is greater than the max_group_length, this will raise a
ValueError.- Parameters:
args – list of arguments to split into groups
max_group_size – max number of elements in any group (default 500)
prefix_length – length of any additional arguments (including spaces) to be passed before the groups from args; default is 0 characters
max_group_length – max length of characters that if a group of args is joined by
" "On unix, this defaults to SC_ARG_MAX from sysconf. On Windows the default is the max usable for CreateProcess (32,768 chars)
- spack.cmd.iter_groups(specs, indent, all_headers)[source]¶
Break a list of specs into groups indexed by arch/compilers.
- spack.cmd.matching_spec_from_env(spec)[source]¶
Returns a concrete spec, matching what is available in the environment. If no matching spec is found in the environment (or if no environment is active), this will return the given spec but concretized.
- spack.cmd.matching_specs_from_env(specs)[source]¶
Same as
matching_spec_from_envbut respects spec unification rules.For each spec, if there is a matching spec in the environment it is used. If no matching spec is found, this will return the given spec but concretized in the context of the active environment and other given specs, with unification rules applied.
- spack.cmd.parse_specs(args: str | List[str], concretize: bool = False, tests: bool | Iterable[str] = False) List[Spec][source]¶
Convenience function for parsing arguments from specs. Handles common exceptions and dies if there are errors.
- spack.cmd.print_how_many_pkgs(specs, pkg_type='', suffix='')[source]¶
Given a list of specs, this will print a message about how many specs are in that list.
- spack.cmd.python_name(cmd_name)[source]¶
Convert
-to_in command name, to make a valid identifier.
- spack.cmd.quote_kvp(string: str) str[source]¶
For strings like
name=valueorname==value, quote and escape the value if needed.This is a compromise to respect quoting of key-value pairs on the CLI. The shell strips quotes from quoted arguments, so we cannot know exactly how CLI arguments were quoted. To compensate, we re-add quotes around anything staritng with
name=orname==, and we assume the rest of the argument is the value. This covers the common cases of passign flags, e.g.,cflags="-O2 -g"on the command line.
- spack.cmd.require_active_env(parser)[source]¶
Used by commands to get the active environment.
If an environment is not found, calls
parser.error()which prints usage and exits.- Parameters:
parser – the subparser for the command (typically
args.subparser)- Returns:
the active environment
- Return type:
- spack.cmd.require_cmd_name(cname)[source]¶
Require that the provided name is a valid command name (per cmd_name()). Useful for checking parameters for function prerequisites.
- spack.cmd.require_python_name(pname)[source]¶
Require that the provided name is a valid python name (per python_name()). Useful for checking parameters for function prerequisites.
Subpackages¶
Submodules¶
spack.cmd.add module¶
- spack.cmd.add.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.arch module¶
- spack.cmd.arch.display_targets(targets)[source]¶
Prints a human readable list of the targets passed as argument.
- spack.cmd.arch.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.audit module¶
- spack.cmd.audit.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.blame module¶
- spack.cmd.blame.dump_json(rows, last_mod, total_lines, emails)[source]¶
Dump the blame as a json object to the terminal.
- spack.cmd.blame.ensure_full_history(prefix: str, path: str) None[source]¶
Ensure the git repository at the prefix has its full history.
- Parameters:
prefix – the root directory of the git repository
path – the package or file name under consideration (for messages)
- spack.cmd.blame.git_prefix(path: str | Path) Path | None[source]¶
Return the top level directory if path is under a git repository.
- Parameters:
path – path of the item presumably under a git repository
Returns: path to the root of the git repository
- spack.cmd.blame.package_repo_root(path: str | Path) Path | None[source]¶
Find the appropriate package repository’s git root directory.
Provides a warning for a remote package repository since there is a risk that the blame results are inaccurate.
- Parameters:
path – path to an arbitrary file presumably in one of the spack package repos
Returns: path to the package repository’s git root directory or None
- spack.cmd.blame.print_table(rows, last_mod, total_lines, emails)[source]¶
Given a set of rows with authors and lines, print a table.
- spack.cmd.blame.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.bootstrap module¶
- spack.cmd.bootstrap.LOCAL_MIRROR_DIR¶
Subdirectory where to create the mirror
- spack.cmd.bootstrap.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.build_env module¶
spack.cmd.buildcache module¶
- exception spack.cmd.buildcache.PackageNotInstalledError(message: str, long_message: str | None = None)[source]¶
Bases:
SpackErrorRaised when a spec is not installed but picked to be packaged.
- exception spack.cmd.buildcache.PackagesAreNotInstalledError(specs: List[Spec])[source]¶
Bases:
SpackErrorRaised when a list of specs is not installed but picked to be packaged.
- spack.cmd.buildcache.check_fn(args: Namespace)[source]¶
check specs against remote binary mirror(s) to see if any need to be rebuilt
this command uses the process exit code to indicate its result, specifically, if the exit code is non-zero, then at least one of the indicated specs needs to be rebuilt
- spack.cmd.buildcache.check_index_fn(args)[source]¶
Check if a build cache index, manifests, and blobs are consistent
- spack.cmd.buildcache.copy_buildcache_entry(cache_entry: URLBuildcacheEntry, destination_url: str)[source]¶
Download buildcache entry and copy it to the destination_url
- spack.cmd.buildcache.download_fn(args)[source]¶
download buildcache entry from a remote mirror to local folder
this command uses the process exit code to indicate its result, specifically, a non-zero exit code indicates that the command failed to download at least one of the required buildcache components
- spack.cmd.buildcache.manifest_copy(manifest_file_list: List[str], dest_mirror: Mirror | None = None)[source]¶
Read manifest files containing information about specific specs to copy from source to destination, remove duplicates since any binary package for a given hash should be the same as any other, and copy all files specified in the manifest files.
- spack.cmd.buildcache.migrate_fn(args)[source]¶
perform in-place binary mirror migration (2 to 3)
A mirror can contain both layout version 2 and version 3 simultaneously without interference. This command performs in-place migration of a binary mirror laid out according to version 2, to a binary mirror laid out according to layout version 3. Only indexed specs will be migrated, so consider updating the mirror index before running this command. Re-run the command to migrate any missing items.
The default mode of operation is to perform a signed migration, that is, spack will attempt to verify the signatures on specs, and then re-sign them before migration, using whatever keys are already installed in your key ring. You can migrate a mirror of unsigned binaries (or convert a mirror of signed binaries to unsigned) by providing the
--unsignedargument.By default spack will leave the original mirror contents (in the old layout) in place after migration. You can have spack remove the old contents by providing the
--delete-existingargument. Because migrating a mostly-already-migrated mirror should be fast, consider a workflow where you perform a default migration, (i.e. preserve the existing layout rather than deleting it) then evaluate the state of the migrated mirror by attempting to install from it, and finally running the migration again with--delete-existing.
- spack.cmd.buildcache.prune_fn(args)[source]¶
prune buildcache entries from the mirror
If a keeplist file is provided, performs direct pruning (deletes packages not in keeplist) followed by orphan pruning. If no keeplist is provided, only performs orphan pruning.
- spack.cmd.buildcache.save_specfile_fn(args)[source]¶
get full spec for dependencies and write them to files in the specified output directory
uses exit code to signal success or failure. an exit code of zero means the command was likely successful. if any errors or exceptions are encountered, or if expected command-line arguments are not provided, then the exit code will be non-zero
- spack.cmd.buildcache.setup_parser(subparser: ArgumentParser)[source]¶
- spack.cmd.buildcache.sync_fn(args)[source]¶
sync binaries (and associated metadata) from one mirror to another
requires an active environment in order to know which specs to sync
- spack.cmd.buildcache.update_index(mirror: Mirror, update_keys=False, timer=timer_mod.NULL_TIMER)[source]¶
spack.cmd.cd module¶
- spack.cmd.cd.setup_parser(subparser: ArgumentParser) None[source]¶
This is for decoration – spack cd is used through spack’s shell support. This allows spack cd to print a descriptive help message when called with -h.
spack.cmd.change module¶
- spack.cmd.change.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.checksum module¶
- spack.cmd.checksum.add_versions_to_pkg(path: str, version_lines: str) int[source]¶
Add new versions to a package.py file. Returns the number of versions added.
- spack.cmd.checksum.print_checksum_status(pkg: PackageBase, version_hashes: dict)[source]¶
Verify checksums present in version_hashes against those present in the package’s instructions.
- Parameters:
pkg (spack.package_base.PackageBase) – A package class for a given package in Spack.
version_hashes (dict) – A dictionary of the form: version -> checksum.
- spack.cmd.checksum.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.ci module¶
- spack.cmd.ci.ci_generate(args)[source]¶
generate jobs file from a CI-aware spack file
if you want to report the results on CDash, you will need to set the SPACK_CDASH_AUTH_TOKEN before invoking this command. the value must be the CDash authorization token needed to create a build group and register all generated jobs under it
- spack.cmd.ci.ci_rebuild(args)[source]¶
rebuild a spec if it is not on the remote mirror
check a single spec against the remote mirror, and rebuild it from source if the mirror does not contain the hash
- spack.cmd.ci.ci_reindex(args)[source]¶
rebuild the buildcache index for the remote mirror
use the active, gitlab-enabled environment to rebuild the buildcache index for the associated mirror
- spack.cmd.ci.ci_reproduce(args)[source]¶
generate instructions for reproducing the spec rebuild job
artifacts of the provided gitlab pipeline rebuild job’s URL will be used to derive instructions for reproducing the build locally
- spack.cmd.ci.ci_verify_versions(args)[source]¶
validate version checksum & commits between git refs This command takes a from_ref and to_ref arguments and then parses the git diff between the two to determine which packages have been modified verifies the new checksums inside of them.
- spack.cmd.ci.setup_parser(subparser: ArgumentParser) None[source]¶
- spack.cmd.ci.unicode_escape(path: str) str[source]¶
Returns transformed path with any unicode characters replaced with their corresponding escapes
- spack.cmd.ci.validate_git_versions(pkg: PackageBase, versions: List[StandardVersion]) bool[source]¶
Get and test the commit and tag of a package version based on a git repository. :param pkg: Spack package for which to validate a version :param versions: list of package versions to validate
Returns: True if all versions are valid, False if any version is invalid.
- spack.cmd.ci.validate_standard_versions(pkg: PackageBase, versions: List[StandardVersion]) bool[source]¶
Get and test the checksum of a package version based on a tarball. :param pkg: Spack package for which to validate a version checksum :param versions: list of package versions to validate
Returns: True if all versions are valid, False if any version is invalid.
spack.cmd.clean module¶
- class spack.cmd.clean.AllClean(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None, deprecated=False)[source]¶
Bases:
ActionActivates flags -s -d -f -m -p and -b simultaneously
- spack.cmd.clean.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.commands module¶
- class spack.cmd.commands.BashCompletionWriter(prog: str, out: IO = sys.stdout, aliases: bool = False)[source]¶
Bases:
ArgparseWriterWrite argparse output as bash programmable tab completion.
- body(positionals: Sequence, optionals: Sequence[str], subcommands: Sequence[str]) str[source]¶
Return the body of the function.
- Parameters:
positionals – List of positional argument tuples (name, choices, nargs, help).
optionals – List of optional arguments.
subcommands – List of subcommand parsers.
- Returns:
Function body.
- end_function(prog: str) str[source]¶
Return the syntax needed to end a function definition.
- Parameters:
prog – Program name
- Returns:
Function definition ending.
- format(cmd: Command) str[source]¶
Return the string representation of a single node in the parser tree.
- Parameters:
cmd – Parsed information about a command or subcommand.
- Returns:
String representation of this subcommand.
- optionals(optionals: Sequence[str]) str[source]¶
Return the syntax for reporting optional flags.
- Parameters:
optionals – List of optional arguments.
- Returns:
Syntax for optional flags.
- positionals(positionals: Sequence) str[source]¶
Return the syntax for reporting positional arguments.
- Parameters:
positionals – List of positional argument tuples (name, choices, nargs, help).
- Returns:
Syntax for positional arguments.
- class spack.cmd.commands.FishCompletionWriter(prog: str, out: IO = sys.stdout, aliases: bool = False)[source]¶
Bases:
ArgparseWriterWrite argparse output as bash programmable tab completion.
- complete(prog: str, positionals: List[Tuple[str, Iterable[Any] | None, int | str | None, str]], optionals: List[Tuple[Sequence[str], List[str], str, int | str | None, str]], subcommands: List[Tuple[ArgumentParser, str, str]]) str[source]¶
Return all the completion commands.
- Parameters:
prog – Program name.
positionals – List of positional arguments.
optionals – List of optional arguments.
subcommands – List of subcommand parsers.
- Returns:
Completion command.
- static complete_head(prog: str, index: int | None = None, nargs: str | int | None = None) str[source]¶
Return the head of the completion command.
- Parameters:
prog – Program name.
index – Index of positional argument.
nargs – Number of arguments.
- Returns:
Head of the completion command.
- format(cmd: Command) str[source]¶
Return the string representation of a single node in the parser tree.
- Parameters:
cmd – Parsed information about a command or subcommand.
- Returns:
String representation of a node.
- optionals(prog: str, optionals: List[Tuple[Sequence[str], List[str], str, int | str | None, str]]) str[source]¶
Return the completion for optional arguments.
- Parameters:
prog – Program name.
optionals – List of optional arguments.
- Returns:
Completion command.
- optspecs(prog: str, optionals: List[Tuple[Sequence[str], List[str], str, int | str | None, str]]) str[source]¶
Read the optionals and return the command to set optspec.
- Parameters:
prog – Program name.
optionals – List of optional arguments.
- Returns:
Command to set optspec variable.
- class spack.cmd.commands.SpackArgparseRstWriter(prog: str, out: IO = sys.stdout, aliases: bool = False, documented_commands: Set[str] = set(), rst_levels: Sequence[str] = ['-', '-', '^', '~', ':', '`'])[source]¶
Bases:
ArgparseRstWriterRST writer tailored for spack documentation.
- class spack.cmd.commands.SubcommandWriter(prog: str, out: IO = sys.stdout, aliases: bool = False)[source]¶
Bases:
ArgparseWriterWrite argparse output as a list of subcommands.
- spack.cmd.commands.bash(args: Namespace, out: IO) None[source]¶
Bash tab-completion script.
- Parameters:
args – Command-line arguments.
out – File object to write to.
- spack.cmd.commands.commands(parser: ArgumentParser, args: Namespace) None[source]¶
Main function that calls formatter functions.
- Parameters:
parser – Argument parser.
args – Command-line arguments.
- spack.cmd.commands.formatter(func: Callable[[Namespace, IO], None]) Callable[[Namespace, IO], None][source]¶
Decorator used to register formatters.
- Parameters:
func – Formatting function.
- Returns:
The same function.
- spack.cmd.commands.formatters: Dict[str, Callable[[Namespace, IO], None]]¶
list of command formatters
- spack.cmd.commands.get_all_spack_commands(out: IO) SpackArgumentParser[source]¶
- spack.cmd.commands.names(args: Namespace, out: IO) None[source]¶
Simple list of top-level commands.
- Parameters:
args – Command-line arguments.
out – File object to write to.
- spack.cmd.commands.prepend_header(args: Namespace, out: IO) None[source]¶
Prepend header text at the beginning of a file.
- Parameters:
args – Command-line arguments.
out – File object to write to.
- spack.cmd.commands.rst(args: Namespace, out: IO) None[source]¶
ReStructuredText documentation of subcommands.
- Parameters:
args – Command-line arguments.
out – File object to write to.
- spack.cmd.commands.rst_index(out: IO) None[source]¶
Generate an index of all commands.
- Parameters:
out – File object to write to.
- spack.cmd.commands.setup_parser(subparser: ArgumentParser) None[source]¶
Set up the argument parser.
- Parameters:
subparser – Preliminary argument parser.
- spack.cmd.commands.subcommands(args: Namespace, out: IO) None[source]¶
Hierarchical tree of subcommands.
- Parameters:
args – Command-line arguments.
out – File object to write to.
- spack.cmd.commands.update_completion(parser: ArgumentParser, args: Namespace) None[source]¶
Iterate through the shells and update the standard completion files.
This is a convenience method to avoid calling this command many times, and to simplify completion update for developers.
- Parameters:
parser – Argument parser.
args – Command-line arguments.
spack.cmd.compiler module¶
- spack.cmd.compiler.compiler_find(args)[source]¶
Search either $PATH or a list of paths OR MODULES for compilers and add them to Spack’s configuration.
- spack.cmd.compiler.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.compilers module¶
- spack.cmd.compilers.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.concretize module¶
- spack.cmd.concretize.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.config module¶
- spack.cmd.config.config_add(args)[source]¶
Add the given configuration to the specified config scope
This is a stateful operation that edits the config files.
- spack.cmd.config.config_edit(args)[source]¶
Edit the configuration file for a specific scope and config section.
With no arguments and an active environment, edit the spack.yaml for the active environment.
- spack.cmd.config.config_get(args)[source]¶
Dump merged YAML configuration for a specific section.
With no arguments and an active environment, print the contents of the environment’s manifest file (spack.yaml).
- spack.cmd.config.config_list(args)[source]¶
List the possible configuration sections.
Used primarily for shell tab completion scripts.
- spack.cmd.config.config_prefer_upstream(args)[source]¶
Generate a packages config based on the configuration of all upstream installs.
- spack.cmd.config.config_remove(args)[source]¶
Remove the given configuration from the specified config scope
This is a stateful operation that edits the config files.
- spack.cmd.config.config_scopes(args)[source]¶
List configured scopes in descending order of precedence.
- spack.cmd.config.print_flattened_configuration(*, blame: bool, yaml: bool) None[source]¶
Prints to stdout a flattened version of the configuration.
- Parameters:
blame – if True, shows file provenance for each entry in the configuration.
- spack.cmd.config.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.containerize module¶
- spack.cmd.containerize.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.create module¶
- class spack.cmd.create.AutoreconfPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for Autotools-based packages that do not come with a
configurescript- base_class_name¶
- body_def¶
- dependencies¶
- package_class_import¶
- class spack.cmd.create.AutotoolsPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for Autotools-based packages that do come with a
configurescript- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.BazelPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for Bazel-based packages
- body_def¶
- dependencies¶
- class spack.cmd.create.BuildSystemAndLanguageGuesser[source]¶
Bases:
objectAn instance of BuildSystemAndLanguageGuesser provides a callable object to be used during
spack create. By passing this object tospack checksum, we can take a peek at the fetched tarball and discern the build system it uses
- class spack.cmd.create.BundlePackageTemplate(name: str, versions, languages: List[str])[source]¶
Bases:
objectProvides the default values to be used for a bundle package file template.
- base_class_name¶
- body_def¶
- dependencies¶
- package_class_import¶
- url_def¶
- class spack.cmd.create.CMakePackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for CMake-based packages
- base_class_name¶
- body_def¶
- package_class_import¶
- spack.cmd.create.CXX_EXT¶
C++ file extensions
- spack.cmd.create.C_EXT¶
C file extensions
- class spack.cmd.create.CargoPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for cargo-based packages
- base_class_name¶
- body_def¶
- package_class_import¶
- spack.cmd.create.FORTRAN_EXT¶
Fortran file extensions
- class spack.cmd.create.GoPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for Go-module-based packages
- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.IntelPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for licensed Intel software
- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.LuaPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for LuaRocks-based packages
- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.MakefilePackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for Makefile packages
- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.MavenPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for Maven-based packages
- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.MesonPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for meson-based packages
- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.OctavePackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for octave packages
- base_class_name¶
- dependencies¶
- package_class_import¶
- class spack.cmd.create.PackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
BundlePackageTemplateProvides the default values to be used for the package file template
- base_class_name¶
- body_def¶
- package_class_import¶
- url_line¶
- class spack.cmd.create.PerlbuildPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PerlmakePackageTemplateProvides appropriate overrides for Perl extensions that come with a Build.PL instead of a Makefile.PL
- dependencies¶
- class spack.cmd.create.PerlmakePackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for Perl extensions that come with a Makefile.PL
- base_class_name¶
- body_def¶
- dependencies¶
- package_class_import¶
- class spack.cmd.create.PythonPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for python extensions
- base_class_name¶
- body_def¶
- dependencies¶
- package_class_import¶
- class spack.cmd.create.QMakePackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for QMake-based packages
- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.RPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for R extensions
- base_class_name¶
- body_def¶
- dependencies¶
- package_class_import¶
- class spack.cmd.create.RacketPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for Racket extensions
- base_class_name¶
- body_def¶
- dependencies¶
- package_class_import¶
- url_line¶
- class spack.cmd.create.RubyPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for Ruby packages
- base_class_name¶
- body_def¶
- dependencies¶
- package_class_import¶
- class spack.cmd.create.SIPPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for SIP packages.
- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.SconsPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate overrides for SCons-based packages
- base_class_name¶
- body_def¶
- package_class_import¶
- class spack.cmd.create.WafPackageTemplate(name, url, versions, languages: List[str])[source]¶
Bases:
PackageTemplateProvides appropriate override for Waf-based packages
- base_class_name¶
- body_def¶
- package_class_import¶
- spack.cmd.create.get_build_system(template: str | None, url: str, guesser: BuildSystemAndLanguageGuesser) str[source]¶
Determine the build system template.
If a template is specified, always use that. Otherwise, if a URL is provided, download the tarball and peek inside to guess what build system it uses. Otherwise, use a generic template by default.
- Parameters:
template –
--templateargument given tospack createurl –
urlargument given tospack createguesser – The first_stage_function given to
spack checksumwhich records the build system it detects
- Returns:
The name of the build system template to use
- Return type:
- spack.cmd.create.get_name(name, url)[source]¶
Get the name of the package based on the supplied arguments.
If a name was provided, always use that. Otherwise, if a URL was provided, extract the name from that. Otherwise, use a default.
- spack.cmd.create.get_repository(args: Namespace, name: str) Repo[source]¶
Returns a Repo object that will allow us to determine the path where the new package file should be created.
- Parameters:
args – The arguments given to
spack createname – The name of the package to create
- Returns:
A Repo object capable of determining the path to the package file
- spack.cmd.create.get_url(url: str | None) str[source]¶
Get the URL to use.
Use a default URL if none is provided.
- Parameters:
url –
urlargument tospack create
Returns: The URL of the package
- spack.cmd.create.get_versions(args: Namespace, name: str) Tuple[str, BuildSystemAndLanguageGuesser][source]¶
Returns a list of versions and hashes for a package.
Also returns a BuildSystemAndLanguageGuesser object.
Returns default values if no URL is provided.
- Parameters:
args – The arguments given to
spack createname – The name of the package
Returns: Tuple of versions and hashes, and a BuildSystemAndLanguageGuesser object
- spack.cmd.create.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.debug module¶
- spack.cmd.debug.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.deconcretize module¶
- spack.cmd.deconcretize.get_deconcretize_list(args: Namespace, specs: List[Spec], env: Environment) List[Spec][source]¶
Get list of environment roots to deconcretize
- spack.cmd.deconcretize.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.dependencies module¶
- spack.cmd.dependencies.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.dependents module¶
- spack.cmd.dependents.get_dependents(pkg_name, ideps, transitive=False, dependents=None)[source]¶
Get all dependents for a package.
- spack.cmd.dependents.inverted_dependencies()[source]¶
Iterate through all packages and return a dictionary mapping package names to possible dependencies.
Virtual packages are included as sources, so that you can query dependents of, e.g.,
mpi, but virtuals are not included as actual dependents.
- spack.cmd.dependents.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.deprecate module¶
Deprecate one Spack install in favor of another
Spack packages of different configurations cannot be installed to the same location. However, in some circumstances (e.g. security patches) old installations should never be used again. In these cases, we will mark the old installation as deprecated, remove it, and link another installation into its place.
It is up to the user to ensure binary compatibility between the deprecated installation and its deprecator.
- spack.cmd.deprecate.setup_parser(sp: ArgumentParser) None[source]¶
spack.cmd.dev_build module¶
- spack.cmd.dev_build.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.develop module¶
- spack.cmd.develop.assure_concrete_spec(env: Environment, spec: Spec)[source]¶
- spack.cmd.develop.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.diff module¶
- spack.cmd.diff.compare_specs(a, b, to_string=False, color=None, ignore_packages=None)[source]¶
Generate a comparison, including diffs (for each side) and an intersection.
We can either print the result to the console, or parse into a json object for the user to save. We return an object that shows the differences, intersection, and names for a pair of specs a and b.
- Parameters:
a (spack.spec.Spec) – the first spec to compare
b (spack.spec.Spec) – the second spec to compare
a_name (str) – the name of spec a
b_name (str) – the name of spec b
to_string (bool) – return an object that can be json dumped
color (bool) – whether to format the names for the console
- spack.cmd.diff.flatten(functions)[source]¶
Given a list of ASP functions, convert into a list of key: value tuples.
We are squashing whatever is after the first index into one string for easier parsing in the interface
- spack.cmd.diff.print_difference(c, attributes='all', out=None)[source]¶
Print the difference.
Given a diffset for A and a diffset for B, print red/green diffs to show the differences.
- spack.cmd.diff.setup_parser(subparser: ArgumentParser) None[source]¶
- spack.cmd.diff.shift(asp_function: AspFunction) AspFunction[source]¶
Transforms
attr("foo", "bar")intofoo("bar").
spack.cmd.docs module¶
spack.cmd.edit module¶
- spack.cmd.edit.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.env module¶
- spack.cmd.env.create_temp_env_directory()[source]¶
Returns the path of a temporary directory in which to create an environment
- spack.cmd.env.env_create_setup_parser(subparser)[source]¶
create a new environment
create a new environment or, optionally, copy an existing environment
a manifest file results in a new abstract environment while a lock file creates a new concrete environment
- spack.cmd.env.env_depfile_setup_parser(subparser)[source]¶
generate a depfile to exploit parallel builds across specs
requires the active environment to be concrete
- spack.cmd.env.env_loads_setup_parser(subparser)[source]¶
list modules for an installed environment ‘(see spack module loads)’
- spack.cmd.env.env_remove_setup_parser(subparser)[source]¶
remove managed environment(s)
remove existing environment(s) managed by Spack
directory environments and manifests embedded in repositories must be removed manually
- spack.cmd.env.env_rename_setup_parser(subparser)[source]¶
rename an existing environment
rename a managed environment or move an independent/directory environment
operation cannot be performed to or from an active environment
- spack.cmd.env.env_revert_setup_parser(subparser)[source]¶
restore the environment manifest to its previous format
revert the environment’s manifest to the schema format from its last ‘spack env update’
the current manifest will be overwritten by the backup copy and the backup copy will be removed
- spack.cmd.env.env_track_setup_parser(subparser)[source]¶
track an environment from a directory in Spack
- spack.cmd.env.env_untrack_setup_parser(subparser)[source]¶
untrack an environment from a directory in Spack
- spack.cmd.env.env_update_setup_parser(subparser)[source]¶
update the environment manifest to the latest schema format
update the environment to the latest schema format, which may not be readable by older versions of spack
a backup copy of the manifest is retained in case there is a need to revert this operation
- spack.cmd.env.env_view_setup_parser(subparser)[source]¶
manage the environment’s view
provide the path when enabling a view with a non-default path
- spack.cmd.env.setup_parser(subparser: ArgumentParser) None[source]¶
- spack.cmd.env.subcommand_functions¶
Dictionary mapping subcommand names and aliases to functions
spack.cmd.extensions module¶
- spack.cmd.extensions.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.external module¶
- exception spack.cmd.external.NoManifestFileError(message: str, long_message: str | None = None)[source]¶
Bases:
SpackError
- spack.cmd.external.packages_to_search_for(*, names: List[str] | None, tags: List[str], exclude: List[str] | None)[source]¶
- spack.cmd.external.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.fetch module¶
- spack.cmd.fetch.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.find module¶
- spack.cmd.find.display_env(env, args, decorator, results)[source]¶
Display extra find output when running in an environment.
In an environment,
spack findoutputs a preliminary section showing the root specs of the environment (this is in addition to the section listing out specs matching the query parameters).
- spack.cmd.find.make_env_decorator(env)[source]¶
Create a function for decorating specs when in an environment.
- spack.cmd.find.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.gc module¶
- spack.cmd.gc.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.gpg module¶
- spack.cmd.gpg.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.graph module¶
- spack.cmd.graph.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.help module¶
- spack.cmd.help.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.info module¶
- class spack.cmd.info.DependencyFormatter[source]¶
Bases:
Formatter- format_name(dep: Dependency) str[source]¶
- format_values(dep: Dependency) str[source]¶
- class spack.cmd.info.Formatter[source]¶
Bases:
objectGeneric formatter for elements displayed by spack info.
Elements have four parts: name, values, when condition, and description. They can be formatted two ways (shown here for variants):
Grouped by when (default):
when +cuda cuda_arch [none] none, 10, 100, 100a, 101, 101a, 11, 12, 120, 120a, 13 CUDA architecture
Or, by name (each name has a when nested under it):
cuda_arch [none] none, 10, 100, 100a, 101, 101a, 11, 12, 120, 120a, 13 when +cuda CUDA architecture
The values and description will be wrapped if needed. the name (and any additional info) will not (so they should be kept short).
Subclasses are responsible for generating colorized text, but not wrapping, indentation, or other formatting, for the name, values, and description.
- spack.cmd.info.MIN_VALUES_WIDTH¶
Allow at least this much room for values when formatting definitions Wrap after a long variant name/condition if we need to do so to preserve this width.
- spack.cmd.info.count_bool_variant_conditions(when_indexed_dictionary: Dict[Spec, Any]) List[Tuple[int, Tuple[str, bool]]][source]¶
Counts boolean variants in whens in a dictionary.
Returns a list of the most used when conditions for boolean variants along with their value.
- spack.cmd.info.info(parser: ArgumentParser, args: Namespace) None[source]¶
- spack.cmd.info.padder(str_list: Iterable, extra: int = 0) Callable[source]¶
Return a function to pad elements of a list.
- spack.cmd.info.print_by_name(pkg: PackageBase, header: str, when_indexed_dictionary: Dict, formatter: Formatter) None[source]¶
- spack.cmd.info.print_definitions(pkg: PackageBase, header: str, when_indexed_dictionary: Dict, formatter: Formatter, by_name: bool) None[source]¶
- spack.cmd.info.print_dependencies(pkg: PackageBase, args: Namespace) None[source]¶
output build, link, and run package dependencies
- spack.cmd.info.print_dependency_suggestion(pkg: PackageBase) None[source]¶
- spack.cmd.info.print_detectable(pkg: PackageBase, args: Namespace) None[source]¶
output information on external detection
- spack.cmd.info.print_grouped_by_when(pkg: PackageBase, header: str, when_indexed_dictionary: Dict, formatter: Formatter) None[source]¶
Generic method to print metadata grouped by when conditions.
- spack.cmd.info.print_header(header: str, when_indexed_dictionary: Dict, formatter: Formatter) bool[source]¶
- spack.cmd.info.print_licenses(pkg: PackageBase, args: Namespace) None[source]¶
Output the licenses of the project.
- spack.cmd.info.print_maintainers(pkg: PackageBase, args: Namespace) None[source]¶
output package maintainers
- spack.cmd.info.print_namespace(pkg: PackageBase, args: Namespace) None[source]¶
output package namespace
- spack.cmd.info.print_phases(pkg: PackageBase, args: Namespace) None[source]¶
output installation phases
- spack.cmd.info.print_tags(pkg: PackageBase, args: Namespace) None[source]¶
output package tags
- spack.cmd.info.print_tests(pkg: PackageBase, args: Namespace) None[source]¶
output relevant build-time and stand-alone tests
- spack.cmd.info.print_variants(pkg: PackageBase, args: Namespace) None[source]¶
output variants
- spack.cmd.info.print_versions(pkg: PackageBase, args: Namespace) None[source]¶
output versions
- spack.cmd.info.print_virtuals(pkg: PackageBase, args: Namespace) None[source]¶
output virtual packages
- spack.cmd.info.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.install module¶
- spack.cmd.install.cache_opt(use_buildcache: str, default: Literal['auto', 'cache_only', 'source_only']) Literal['auto', 'cache_only', 'source_only'][source]¶
- spack.cmd.install.compute_tests_install_kwargs(specs, cli_test_arg)[source]¶
Translate the test cli argument into the proper install argument
- spack.cmd.install.concrete_specs_from_cli(args, install_kwargs)[source]¶
Return abstract and concrete spec parsed from the command line.
- spack.cmd.install.default_log_file(spec)[source]¶
Computes the default filename for the log file and creates the corresponding directory if not present
- spack.cmd.install.install_kwargs_from_args(args)[source]¶
Translate command line arguments into a dictionary that will be passed to the package installer.
- spack.cmd.install.install_with_active_env(env: Environment, args, install_kwargs, reporter)[source]¶
- spack.cmd.install.report_filename(args: Namespace, specs: List[Spec]) str[source]¶
Return the filename to be used for reporting to JUnit or CDash format.
- spack.cmd.install.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.license module¶
- class spack.cmd.license.ErrorType(*values)[source]¶
Bases:
Enum- GENERAL_MISMATCH¶
- NOT_IN_FIRST_N_LINES¶
- SPDX_MISMATCH¶
- spack.cmd.license.apache2_mit_spdx¶
Spack’s license identifier
- spack.cmd.license.license_line_regexes¶
regexes for valid license lines at tops of files
- spack.cmd.license.license_lines¶
SPDX license id must appear in the first <license_lines> lines of a file
- spack.cmd.license.licensed_files_patterns¶
regular expressions for licensed files.
- spack.cmd.license.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.list module¶
- spack.cmd.list.filter_by_name(pkgs, args)[source]¶
Filters the sequence of packages according to user prescriptions
- Parameters:
pkgs – sequence of packages
args – parsed command line arguments
- Returns:
filtered and sorted list of packages
- spack.cmd.list.github_url(pkg: Type[PackageBase]) str | None[source]¶
Link to a package file in spack package’s github or the path to the file.
- Parameters:
pkg – package instance
Returns: URL to the package file on github or the local file path; otherwise,
None.
- spack.cmd.list.html(pkg_names, out)[source]¶
Print out information on all packages in Sphinx HTML.
This is intended to be inlined directly into Sphinx documentation. We write HTML instead of RST for speed; generating RST from all packages causes the Sphinx build to take forever. Including this as raw HTML is much faster.
- spack.cmd.list.rows_for_ncols(elts, ncols)[source]¶
Print out rows in a table with ncols of elts laid out vertically.
- spack.cmd.list.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.load module¶
- spack.cmd.load.setup_parser(subparser: ArgumentParser) None[source]¶
Parser is only constructed so that this prints a nice help message with -h.
spack.cmd.location module¶
- spack.cmd.location.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.log_parse module¶
- spack.cmd.log_parse.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.logs module¶
- spack.cmd.logs.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.maintainers module¶
- spack.cmd.maintainers.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.make_installer module¶
- spack.cmd.make_installer.make_installer(parser, args)[source]¶
Use CMake to generate WIX installer in newly created build directory
- spack.cmd.make_installer.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.mark module¶
- spack.cmd.mark.find_matching_specs(specs: List[str | Spec], allow_multiple_matches: bool = False) List[Spec][source]¶
Returns a list of specs matching the not necessarily concretized specs given from cli
- Parameters:
specs – list of specs to be matched against installed packages
allow_multiple_matches – if True multiple matches are admitted
- spack.cmd.mark.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.mirror module¶
- spack.cmd.mirror.concrete_specs_from_user(args)[source]¶
Return the list of concrete specs that the user wants to mirror. The list is passed either from command line or from a text file.
- spack.cmd.mirror.create(path, specs, skip_unstable_versions=False)[source]¶
Create a directory to be used as a spack mirror, and fill it with package archives.
- Parameters:
path – Path to create a mirror directory hierarchy in.
specs – Any package versions matching these specs will be added to the mirror.
skip_unstable_versions – if true, this skips adding resources when they do not have a stable archive checksum (as determined by
fetch_strategy.stable_target)
- Returns:
A tuple of lists, each containing specs
present: Package specs that were already present.
mirrored: Package specs that were successfully mirrored.
error: Package specs that failed to mirror due to some error.
- spack.cmd.mirror.create_mirror_for_all_specs(mirror_specs, path, skip_unstable_versions, workers)[source]¶
- spack.cmd.mirror.extend_with_dependencies(specs)[source]¶
Extend the input list by adding all the dependencies explicitly.
- spack.cmd.mirror.mirror_create(args)[source]¶
create a directory to be used as a spack mirror, and fill it with package archives
- spack.cmd.mirror.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.module module¶
- spack.cmd.module.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.patch module¶
- spack.cmd.patch.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.pkg module¶
- spack.cmd.pkg.pkg_grep(args, unknown_args)[source]¶
grep for strings in package.py files from all repositories
- spack.cmd.pkg.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.providers module¶
- spack.cmd.providers.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.pydoc module¶
- spack.cmd.pydoc.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.python module¶
- spack.cmd.python.ipython_interpreter(args)[source]¶
An ipython interpreter is intended to be interactive, so it doesn’t support running a script or arguments
- spack.cmd.python.propagate_exceptions_from(console)[source]¶
Set sys.excepthook to let uncaught exceptions return 1 to the shell.
- Parameters:
console (code.InteractiveConsole) – the console that needs a change in sys.excepthook
- spack.cmd.python.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.reindex module¶
spack.cmd.remove module¶
- spack.cmd.remove.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.repo module¶
- spack.cmd.repo.repo_list(args)[source]¶
show registered repositories and their namespaces
List all package repositories known to Spack. Repositories can be local directories or remote git repositories.
- spack.cmd.repo.repo_migrate(args: Any) int[source]¶
migrate a package repository to the latest Package API
- spack.cmd.repo.repo_show_version_updates(args)[source]¶
show version specs that were added between two commits
- spack.cmd.repo.setup_parser(subparser: ArgumentParser)[source]¶
spack.cmd.resource module¶
- spack.cmd.resource.resource_list(args)[source]¶
list all resources known to spack (currently just patches)
- spack.cmd.resource.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.restage module¶
- spack.cmd.restage.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.solve module¶
- spack.cmd.solve.setup_parser(subparser: ArgumentParser) None[source]¶
- spack.cmd.solve.show_options¶
output options
spack.cmd.spec module¶
- spack.cmd.spec.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.stage module¶
- class spack.cmd.stage.StageFilter(exclusions, skip_installed)[source]¶
Bases:
objectEncapsulation of reasons to skip staging
- spack.cmd.stage.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.style module¶
- spack.cmd.style.changed_files(base='develop', untracked=True, all_files=False, root=None) List[Path][source]¶
Get list of changed files in the Spack repository.
- spack.cmd.style.cwd_relative(path: Path, root: Path | str, initial_working_dir: Path) Path[source]¶
Translate prefix-relative path to current working directory-relative.
- spack.cmd.style.exclude_paths¶
List of paths to exclude from checks – relative to spack root
- spack.cmd.style.mypy_ignores¶
warnings to ignore in mypy
- spack.cmd.style.rewrite_and_print_output(output, root, working_dir, root_relative, re_obj=re.compile('^(.+):([0-9]+):'), replacement='{0}:{1}:')[source]¶
rewrite output with <file>:<line>: format to respect path args
- spack.cmd.style.ruff_check(file_list, args)[source]¶
Run the ruff-check command. Handles config and non generic ruff argument logic
- spack.cmd.style.run_ruff(file_list: List[Path], cmd: str, args: List[str], root: Path, working_dir: Path, root_relative: bool)[source]¶
Run the ruff tool
- spack.cmd.style.setup_parser(subparser: ArgumentParser) None[source]¶
- class spack.cmd.style.tool(name: str, cmd: str | None = None, required: bool = False, external: bool = True)[source]¶
Bases:
object- property executable: Executable | None¶
- spack.cmd.style.tool_names¶
Order in which tools should be run. The list maps an executable name to a method to ensure the tool is bootstrapped or present in the environment.
spack.cmd.test module¶
- spack.cmd.test.setup_parser(subparser: ArgumentParser) None[source]¶
- spack.cmd.test.test_find(args)[source]¶
find tests that are running or have available results
displays aliases for tests that have them, otherwise test suite content hashes
- spack.cmd.test.test_remove(args)[source]¶
remove results from Spack test suite(s) (default all)
if no test suite is listed, remove results for all suites.
removed tests can no longer be accessed for results or status, and will not appear in
spack test listresults
spack.cmd.test_env module¶
spack.cmd.tutorial module¶
- spack.cmd.tutorial.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.undevelop module¶
- spack.cmd.undevelop.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.uninstall module¶
- spack.cmd.uninstall.all_specs_in_env(env: Environment, specs: List[Spec]) List[Spec][source]¶
Given a list of specs, return those that are in the env
- spack.cmd.uninstall.dependent_environments(specs: List[Spec], current_env: Environment | None = None) Dict[Environment, List[Spec]][source]¶
- spack.cmd.uninstall.find_matching_specs(env: Environment | None, specs: List[Spec], allow_multiple_matches: bool = False, origin=None) List[Spec][source]¶
Returns a list of specs matching the not necessarily concretized specs given from cli
- Parameters:
env – optional active environment
specs – list of specs to be matched against installed packages
allow_multiple_matches – if True multiple matches are admitted
origin – origin of the spec
- spack.cmd.uninstall.get_uninstall_list(args, specs: List[Spec], env: Environment | None)[source]¶
Returns unordered uninstall_list and remove_list: these may overlap (some things may be both uninstalled and removed from the current environment).
It is assumed we are in an environment if
--removeis specified (this method raises an exception otherwise).
- spack.cmd.uninstall.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.unit_test module¶
- spack.cmd.unit_test.add_back_pytest_args(args, unknown_args)[source]¶
Add parsed pytest args, unknown args, and remainder together.
We add some basic pytest arguments to the Spack parser to ensure that they show up in the short help, so we have to reassemble things here.
- spack.cmd.unit_test.do_list(args, extra_args)[source]¶
Print a lists of tests than what pytest offers.
- spack.cmd.unit_test.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.unload module¶
- spack.cmd.unload.setup_parser(subparser: ArgumentParser) None[source]¶
Parser is only constructed so that this prints a nice help message with -h.
spack.cmd.url module¶
- spack.cmd.url.name_parsed_correctly(pkg, name)[source]¶
Determine if the name of a package was correctly parsed.
- Parameters:
pkg (spack.package_base.PackageBase) – The Spack package
name (str) – The name that was extracted from the URL
- Returns:
True if the name was correctly parsed, else False
- Return type:
- spack.cmd.url.print_name_and_version(url)[source]¶
Prints a URL. Underlines the detected name with dashes and the detected version with tildes.
- Parameters:
url (str) – The url to parse
- spack.cmd.url.remove_prefix(pkg_name)[source]¶
Remove build system prefix (
'py-','perl-', etc.) from a package name.After determining a name,
spack createdetermines a build system. Some build systems prepend a special string to the front of the name. Since this can’t be guessed from the URL, it would be unfair to say that these names are incorrectly parsed, so we remove them.
- spack.cmd.url.remove_separators(version)[source]¶
Remove separator characters (
.,_, and-) from a version.A version like 1.2.3 may be displayed as 1_2_3 in the URL. Make sure 1.2.3, 1-2-3, 1_2_3, and 123 are considered equal. Unfortunately, this also means that 1.23 and 12.3 are equal.
- Parameters:
version (str or spack.version.Version) – A version
- Returns:
The version with all separator characters removed
- Return type:
- spack.cmd.url.setup_parser(subparser: ArgumentParser) None[source]¶
- spack.cmd.url.url_list_parsing(args, urls, url, pkg)[source]¶
Helper function for
url_list().- Parameters:
args (argparse.Namespace) – The arguments given to
spack url listurls (set) – List of URLs that have already been added
url (str or None) – A URL to potentially add to
urlsdepending onargspkg (spack.package_base.PackageBase) – The Spack package
- Returns:
The updated set of
urls- Return type:
- spack.cmd.url.version_parsed_correctly(pkg, version)[source]¶
Determine if the version of a package was correctly parsed.
- Parameters:
pkg (spack.package_base.PackageBase) – The Spack package
version (str) – The version that was extracted from the URL
- Returns:
True if the name was correctly parsed, else False
- Return type:
spack.cmd.verify module¶
- spack.cmd.verify.setup_parser(subparser: ArgumentParser)[source]¶
- spack.cmd.verify.verify_libraries(args)[source]¶
verify that shared libraries of install packages can be located in rpaths (Linux only)
- spack.cmd.verify.verify_manifest(args)[source]¶
verify that install directories have not been modified since installation
- spack.cmd.verify.verify_versions(args)[source]¶
Check that all versions of installed packages are known to Spack and non-deprecated.
Reports errors for any of the following:
Installed package not loadable from the repo
Installed package version not known by the package recipe
Installed package version deprecated in the package recipe
spack.cmd.versions module¶
- spack.cmd.versions.setup_parser(subparser: ArgumentParser) None[source]¶
spack.cmd.view module¶
Produce a “view” of a Spack DAG.
A “view” is file hierarchy representing the union of a number of Spack-installed package file hierarchies. The union is formed from:
specs resolved from the package names given by the user (the seeds)
all dependencies of the seeds unless user specifies
--no-dependenciesless any specs with names matching the regular expressions given by
--exclude
The view can be built and tore down via a number of methods (the “actions”):
symlink :: a file system view which is a directory hierarchy that is the union of the hierarchies of the installed packages in the DAG where installed files are referenced via symlinks.
hardlink :: like the symlink view but hardlinks are used.
statlink :: a view producing a status report of a symlink or hardlink view.
The file system view concept is inspired by Nix, implemented by Brett Viren ca 2016.
All operations on views are performed via proxy objects such as YamlFilesystemView.
- spack.cmd.view.disambiguate_in_view(specs, view)[source]¶
When dealing with querying actions (remove/status) we only need to disambiguate among specs in the view
- spack.cmd.view.setup_parser(sp: ArgumentParser) None[source]¶