spack.cmd package

Submodules

spack.cmd.activate module

spack.cmd.activate.activate(parser, args)
spack.cmd.activate.setup_parser(subparser)

spack.cmd.arch module

spack.cmd.arch.arch(parser, args)
spack.cmd.arch.setup_parser(subparser)

spack.cmd.bootstrap module

spack.cmd.bootstrap.bootstrap(parser, args, **kwargs)
spack.cmd.bootstrap.setup_parser(subparser)

spack.cmd.build module

spack.cmd.build.build(parser, args)
spack.cmd.build.setup_parser(subparser)

spack.cmd.buildcache module

spack.cmd.buildcache.buildcache(parser, args)
spack.cmd.buildcache.createtarball(args)
spack.cmd.buildcache.getkeys(args)
spack.cmd.buildcache.install_tarball(spec, args)
spack.cmd.buildcache.installtarball(args)
spack.cmd.buildcache.listspecs(args)
spack.cmd.buildcache.setup_parser(subparser)

spack.cmd.cd module

spack.cmd.cd.cd(parser, args)
spack.cmd.cd.setup_parser(subparser)

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.checksum module

spack.cmd.checksum.checksum(parser, args)
spack.cmd.checksum.get_checksums(url_dict, name, **kwargs)

Fetches and checksums archives from URLs.

This function is called by both spack checksum and spack create. The first_stage_function kwarg allows spack create to determine things like the build system of the archive.

Parameters:
  • url_dict (dict) – A dictionary of the form: version -> URL
  • name (str) – The name of the package
  • first_stage_function (callable) – Function to run on first staging area
  • keep_stage (bool) – Don’t clean up staging area when command completes
Returns:

A multi-line string containing versions and corresponding hashes

Return type:

str

spack.cmd.checksum.setup_parser(subparser)

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)

Bases: argparse.Action

Activates flags -s -d and -m simultaneously

spack.cmd.clean.clean(parser, args)
spack.cmd.clean.setup_parser(subparser)

spack.cmd.clone module

spack.cmd.clone.clone(parser, args)
spack.cmd.clone.get_origin_info(remote)
spack.cmd.clone.setup_parser(subparser)

spack.cmd.compiler module

spack.cmd.compiler.compiler(parser, args)
spack.cmd.compiler.compiler_find(args)

Search either $PATH or a list of paths OR MODULES for compilers and add them to Spack’s configuration.

spack.cmd.compiler.compiler_info(args)

Print info about all compilers matching a spec.

spack.cmd.compiler.compiler_list(args)
spack.cmd.compiler.compiler_remove(args)
spack.cmd.compiler.setup_parser(subparser)

spack.cmd.compilers module

spack.cmd.compilers.compilers(parser, args)
spack.cmd.compilers.setup_parser(subparser)

spack.cmd.config module

spack.cmd.config.config(parser, args)
spack.cmd.config.config_edit(args)
spack.cmd.config.config_get(args)
spack.cmd.config.setup_parser(subparser)

spack.cmd.configure module

spack.cmd.configure.configure(parser, args)
spack.cmd.configure.setup_parser(subparser)

spack.cmd.create module

class spack.cmd.create.AutoreconfPackageTemplate(name, url, versions)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for Autotools-based packages that do not come with a configure script

base_class_name = 'AutotoolsPackage'
body = " def autoreconf(self, spec, prefix):\n # FIXME: Modify the autoreconf method as necessary\n autoreconf('--install', '--verbose', '--force')\n\n def configure_args(self):\n # FIXME: Add arguments other than --prefix\n # FIXME: If not needed delete this function\n args = []\n return args"
dependencies = " depends_on('autoconf', type='build')\n depends_on('automake', type='build')\n depends_on('libtool', type='build')\n depends_on('m4', type='build')\n\n # FIXME: Add additional dependencies if required.\n # depends_on('foo')"
class spack.cmd.create.AutotoolsPackageTemplate(name, url, versions)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for Autotools-based packages that do come with a configure script

base_class_name = 'AutotoolsPackage'
body = ' def configure_args(self):\n # FIXME: Add arguments other than --prefix\n # FIXME: If not needed delete this function\n args = []\n return args'
class spack.cmd.create.BazelPackageTemplate(name, url, versions)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for Bazel-based packages

body = ' def install(self, spec, prefix):\n # FIXME: Add logic to build and install here.\n bazel()'
dependencies = " # FIXME: Add additional dependencies if required.\n depends_on('bazel', type='build')"
class spack.cmd.create.BuildSystemGuesser

An instance of BuildSystemGuesser provides a callable object to be used during spack create. By passing this object to spack checksum, we can take a peek at the fetched tarball and discern the build system it uses

class spack.cmd.create.CMakePackageTemplate(name, url, versions)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for CMake-based packages

base_class_name = 'CMakePackage'
body = ' def cmake_args(self):\n # FIXME: Add arguments other than\n # FIXME: CMAKE_INSTALL_PREFIX and CMAKE_BUILD_TYPE\n # FIXME: If not needed delete this function\n args = []\n return args'
class spack.cmd.create.IntelPackageTemplate(name, url, versions)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for licensed Intel software

base_class_name = 'IntelPackage'
body = ' # FIXME: Override `setup_environment` if necessary.'
class spack.cmd.create.MakefilePackageTemplate(name, url, versions)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for Makefile packages

base_class_name = 'MakefilePackage'
body = " def edit(self, spec, prefix):\n # FIXME: Edit the Makefile if necessary\n # FIXME: If not needed delete this function\n # makefile = FileFilter('Makefile')\n # makefile.filter('CC = .*', 'CC = cc')"
class spack.cmd.create.OctavePackageTemplate(name, *args)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for octave packages

body = " def install(self, spec, prefix):\n # FIXME: Add logic to build and install here.\n octave('--quiet', '--norc',\n '--built-in-docstrings-file=/dev/null',\n '--texi-macros-file=/dev/null',\n '--eval', 'pkg prefix {0}; pkg install {1}'.format(\n prefix, self.stage.archive_file))"
dependencies = " extends('octave')\n\n # FIXME: Add additional dependencies if required.\n # depends_on('octave-foo', type=('build', 'run'))"
class spack.cmd.create.PackageTemplate(name, url, versions)

Bases: object

Provides the default values to be used for the package file template

base_class_name = 'Package'
body = " def install(self, spec, prefix):\n # FIXME: Unknown build system\n make()\n make('install')"
dependencies = " # FIXME: Add dependencies if required.\n # depends_on('foo')"
write(pkg_path)

Writes the new package file.

class spack.cmd.create.PerlbuildPackageTemplate(name, *args)

Bases: spack.cmd.create.PerlmakePackageTemplate

Provides appropriate overrides for Perl extensions that come with a Build.PL instead of a Makefile.PL

dependencies = " depends_on('perl-module-build', type='build')\n\n # FIXME: Add additional dependencies if required:\n # depends_on('perl-foo', type=('build', 'run'))"
class spack.cmd.create.PerlmakePackageTemplate(name, *args)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for Perl extensions that come with a Makefile.PL

base_class_name = 'PerlPackage'
body = ' def configure_args(self):\n # FIXME: Add non-standard arguments\n # FIXME: If not needed delete this function\n args = []\n return args'
dependencies = " # FIXME: Add dependencies if required:\n # depends_on('perl-foo', type=('build', 'run'))"
class spack.cmd.create.PythonPackageTemplate(name, *args)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for python extensions

base_class_name = 'PythonPackage'
body = ' def build_args(self, spec, prefix):\n # FIXME: Add arguments other than --prefix\n # FIXME: If not needed delete this function\n args = []\n return args'
dependencies = " # FIXME: Add dependencies if required.\n # depends_on('py-setuptools', type='build')\n # depends_on('py-foo', type=('build', 'run'))"
class spack.cmd.create.QMakePackageTemplate(name, url, versions)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for QMake-based packages

base_class_name = 'QMakePackage'
body = ' def qmake_args(self):\n # FIXME: If not needed delete this function\n args = []\n return args'
class spack.cmd.create.RPackageTemplate(name, *args)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for R extensions

base_class_name = 'RPackage'
body = ' def configure_args(self, spec, prefix):\n # FIXME: Add arguments to pass to install via --configure-args\n # FIXME: If not needed delete this function\n args = []\n return args'
dependencies = " # FIXME: Add dependencies if required.\n # depends_on('r-foo', type=('build', 'run'))"
class spack.cmd.create.SconsPackageTemplate(name, url, versions)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate overrides for SCons-based packages

base_class_name = 'SConsPackage'
body = ' def build_args(self, spec, prefix):\n # FIXME: Add arguments to pass to build.\n # FIXME: If not needed delete this function\n args = []\n return args'
class spack.cmd.create.WafPackageTemplate(name, url, versions)

Bases: spack.cmd.create.PackageTemplate

Provides appropriate override for Waf-based packages

base_class_name = 'WafPackage'
body = ' # FIXME: Override configure_args(), build_args(),\n # or install_args() if necessary.'
spack.cmd.create.create(parser, args)
spack.cmd.create.get_build_system(args, guesser)

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:
  • args (argparse.Namespace) – The arguments given to spack create
  • guesser (BuildSystemGuesser) – The first_stage_function given to spack checksum which records the build system it detects
Returns:

The name of the build system template to use

Return type:

str

spack.cmd.create.get_name(args)

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.

Parameters:args (param argparse.Namespace) – The arguments given to spack create
Returns:The name of the package
Return type:str
spack.cmd.create.get_repository(args, name)

Returns a Repo object that will allow us to determine the path where the new package file should be created.

Parameters:
  • args (argparse.Namespace) – The arguments given to spack create
  • name (str) – The name of the package to create
Returns:

A Repo object capable of determining the path to the package file

Return type:

Repo

spack.cmd.create.get_url(args)

Get the URL to use.

Use a default URL if none is provided.

Parameters:args (argparse.Namespace) – The arguments given to spack create
Returns:The URL of the package
Return type:str
spack.cmd.create.get_versions(args, name)

Returns a list of versions and hashes for a package.

Also returns a BuildSystemGuesser object.

Returns default values if no URL is provided.

Parameters:
  • args (argparse.Namespace) – The arguments given to spack create
  • name (str) – The name of the package
Returns:

Versions and hashes, and a

BuildSystemGuesser object

Return type:

str and BuildSystemGuesser

spack.cmd.create.setup_parser(subparser)

spack.cmd.deactivate module

spack.cmd.deactivate.deactivate(parser, args)
spack.cmd.deactivate.setup_parser(subparser)

spack.cmd.debug module

spack.cmd.debug.create_db_tarball(args)
spack.cmd.debug.debug(parser, args)
spack.cmd.debug.setup_parser(subparser)

spack.cmd.dependencies module

spack.cmd.dependencies.dependencies(parser, args)
spack.cmd.dependencies.setup_parser(subparser)

spack.cmd.dependents module

spack.cmd.dependents.dependents(parser, args)
spack.cmd.dependents.get_dependents(pkg_name, ideps, transitive=False, dependents=None)

Get all dependents for a package.

Parameters:
  • pkg_name (str) – name of the package whose dependents should be returned
  • ideps (dict) – dictionary of dependents, from inverted_dependencies()
  • transitive (bool, optional) – return transitive dependents when True
spack.cmd.dependents.inverted_dependencies()

Iterate through all packages and return a dictionary mapping package names to possible dependnecies.

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)

spack.cmd.diy module

spack.cmd.diy.diy(self, args)
spack.cmd.diy.setup_parser(subparser)

spack.cmd.docs module

spack.cmd.docs.docs(parser, args)

spack.cmd.edit module

spack.cmd.edit.edit(parser, args)
spack.cmd.edit.edit_package(name, repo_path, namespace)

Opens the requested package file in your favorite $EDITOR.

Parameters:
  • name (str) – The name of the package
  • repo_path (str) – The path to the repository containing this package
  • namespace (str) – A valid namespace registered with Spack
spack.cmd.edit.setup_parser(subparser)

spack.cmd.env module

spack.cmd.env.env(parser, args)
spack.cmd.env.setup_parser(subparser)

spack.cmd.extensions module

spack.cmd.extensions.extensions(parser, args)
spack.cmd.extensions.setup_parser(subparser)

spack.cmd.fetch module

spack.cmd.fetch.fetch(parser, args)
spack.cmd.fetch.setup_parser(subparser)

spack.cmd.find module

spack.cmd.find.find(parser, args)
spack.cmd.find.query_arguments(args)
spack.cmd.find.setup_parser(subparser)

spack.cmd.flake8 module

spack.cmd.flake8.changed_files(args)

Get list of changed files in the Spack repository.

spack.cmd.flake8.exclude_directories = ['/home/docs/checkouts/readthedocs.org/user_builds/spack/checkouts/latest/lib/spack/external']

This is a dict that maps

filename pattern ->
a flake8 exemption code ->
list of patterns, for which matching lines should have codes applied.
spack.cmd.flake8.filter_file(source, dest, output=False)

Filter a single file through all the patterns in exemptions.

spack.cmd.flake8.flake8(parser, args)
spack.cmd.flake8.level = 'long'

List of directories to exclude from checks.

spack.cmd.flake8.setup_parser(subparser)

spack.cmd.gpg module

spack.cmd.gpg.gpg(parser, args)
spack.cmd.gpg.gpg_create(args)
spack.cmd.gpg.gpg_export(args)
spack.cmd.gpg.gpg_init(args)
spack.cmd.gpg.gpg_list(args)
spack.cmd.gpg.gpg_sign(args)
spack.cmd.gpg.gpg_trust(args)
spack.cmd.gpg.gpg_untrust(args)
spack.cmd.gpg.gpg_verify(args)
spack.cmd.gpg.setup_parser(subparser)

spack.cmd.graph module

spack.cmd.graph.graph(parser, args)
spack.cmd.graph.setup_parser(subparser)

spack.cmd.help module

spack.cmd.help.help(parser, args)
spack.cmd.help.setup_parser(subparser)

spack.cmd.info module

class spack.cmd.info.VariantFormatter(variants, max_widths=(30, 20, 30))

Bases: object

default(v)
lines
spack.cmd.info.info(parser, args)
spack.cmd.info.padder(str_list, extra=0)

Return a function to pad elements of a list.

spack.cmd.info.print_text_info(pkg)

Print out a plain text description of a package.

spack.cmd.info.section_title(s)
spack.cmd.info.setup_parser(subparser)
spack.cmd.info.variant(s)
spack.cmd.info.version(s)

spack.cmd.install module

class spack.cmd.install.TestCase(classname, name)

Bases: object

results = {0: None, 1: 'failure', 2: 'skipped', 3: 'error'}
set_duration(duration)
set_result(result_type, message=None, error_type=None, text=None)
class spack.cmd.install.TestResult

Bases: object

ERRORED = 3
FAILED = 1
PASSED = 0
SKIPPED = 2
class spack.cmd.install.TestSuite(spec)

Bases: object

append(item)
dump(filename)
spack.cmd.install.default_log_file(spec)

Computes the default filename for the log file and creates the corresponding directory if not present

spack.cmd.install.fetch_text(path)
spack.cmd.install.install(parser, args, **kwargs)
spack.cmd.install.junit_output(spec, test_suite)
spack.cmd.install.setup_parser(subparser)

spack.cmd.list module

spack.cmd.list.filter_by_name(pkgs, args)

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.formatter(func)

Decorator used to register formatters

spack.cmd.list.list(parser, args)
spack.cmd.list.name_only(pkgs)
spack.cmd.list.rst(pkgs)

Print out information on all packages in restructured text.

spack.cmd.list.setup_parser(subparser)

spack.cmd.load module

spack.cmd.load.load(parser, args)
spack.cmd.load.setup_parser(subparser)

Parser is only constructed so that this prints a nice help message with -h.

spack.cmd.location module

spack.cmd.location.location(parser, args)
spack.cmd.location.setup_parser(subparser)

spack.cmd.md5 module

spack.cmd.md5.compute_md5_checksum(url)
spack.cmd.md5.md5(parser, args)
spack.cmd.md5.normalized(files)
spack.cmd.md5.setup_parser(subparser)

spack.cmd.mirror module

spack.cmd.mirror.mirror(parser, args)
spack.cmd.mirror.mirror_add(args)

Add a mirror to Spack.

spack.cmd.mirror.mirror_create(args)

Create a directory to be used as a spack mirror, and fill it with package archives.

spack.cmd.mirror.mirror_list(args)

Print out available mirrors to the console.

spack.cmd.mirror.mirror_remove(args)

Remove a mirror by name.

spack.cmd.mirror.setup_parser(subparser)

spack.cmd.module module

exception spack.cmd.module.MultipleModuleTypes

Bases: exceptions.Exception

Raised when multiple module types match a cli request, in a context where this is not allowed.

exception spack.cmd.module.MultipleSpecsMatch

Bases: exceptions.Exception

Raised when multiple specs match a constraint, in a context where this is not allowed.

exception spack.cmd.module.NoSpecMatches

Bases: exceptions.Exception

Raised when no spec matches a constraint, in a context where this is not allowed.

spack.cmd.module.callbacks = {'rm': <function rm>, 'loads': <function loads>, 'find': <function find>, 'refresh': <function refresh>}

Dictionary that will be populated with the list of sub-commands Each sub-command must be callable and accept 3 arguments:

  • mtype : the type of the module file
  • specs : the list of specs to be processed
  • args : namespace containing the parsed command line arguments
spack.cmd.module.find(module_types, specs, args)

Returns the module file “use” name if there’s a single match. Raises error messages otherwise.

spack.cmd.module.loads(module_types, specs, args)

Prompt the list of modules associated with a list of specs

spack.cmd.module.module(parser, args)
spack.cmd.module.one_module_or_raise(module_types)

Ensures exactly one module type has been selected, or raises the appropriate exception.

spack.cmd.module.one_spec_or_raise(specs)

Ensures exactly one spec has been selected, or raises the appropriate exception.

spack.cmd.module.refresh(module_types, specs, args)

Regenerates the module files for every spec in specs and every module type in module types.

spack.cmd.module.rm(module_types, specs, args)

Deletes the module files associated with every spec in specs, for every module type in module types.

spack.cmd.module.setup_parser(subparser)
spack.cmd.module.subcommand(subparser_name)

Registers a function in the callbacks dictionary

spack.cmd.patch module

spack.cmd.patch.patch(parser, args)
spack.cmd.patch.setup_parser(subparser)

spack.cmd.pkg module

spack.cmd.pkg.diff_packages(rev1, rev2)
spack.cmd.pkg.get_git(fatal=True)
spack.cmd.pkg.list_packages(rev)
spack.cmd.pkg.pkg(parser, args)
spack.cmd.pkg.pkg_add(args)
spack.cmd.pkg.pkg_added(args)

Show packages added since a commit.

spack.cmd.pkg.pkg_diff(args)

Compare packages available in two different git revisions.

spack.cmd.pkg.pkg_list(args)

List packages associated with a particular spack git revision.

spack.cmd.pkg.pkg_removed(args)

Show packages removed since a commit.

spack.cmd.pkg.setup_parser(subparser)

spack.cmd.providers module

spack.cmd.providers.providers(parser, args)
spack.cmd.providers.setup_parser(subparser)

spack.cmd.pydoc module

spack.cmd.pydoc.pydoc(parser, args)
spack.cmd.pydoc.setup_parser(subparser)

spack.cmd.python module

spack.cmd.python.python(parser, args)
spack.cmd.python.setup_parser(subparser)

spack.cmd.reindex module

spack.cmd.reindex.reindex(parser, args)

spack.cmd.repo module

spack.cmd.repo.repo(parser, args)
spack.cmd.repo.repo_add(args)

Add a package source to Spack’s configuration.

spack.cmd.repo.repo_create(args)

Create a new package repository.

spack.cmd.repo.repo_list(args)

Show registered repositories and their namespaces.

spack.cmd.repo.repo_remove(args)

Remove a repository from Spack’s configuration.

spack.cmd.repo.setup_parser(subparser)

spack.cmd.restage module

spack.cmd.restage.restage(parser, args)
spack.cmd.restage.setup_parser(subparser)

spack.cmd.setup module

spack.cmd.setup.setup(self, args)
spack.cmd.setup.setup_parser(subparser)
spack.cmd.setup.spack_transitive_include_path()
spack.cmd.setup.write_spconfig(package)

spack.cmd.spec module

spack.cmd.spec.setup_parser(subparser)
spack.cmd.spec.spec(parser, args)

spack.cmd.stage module

spack.cmd.stage.setup_parser(subparser)
spack.cmd.stage.stage(parser, args)

spack.cmd.test module

spack.cmd.test.do_list(args, unknown_args)

Print a lists of tests than what pytest offers.

spack.cmd.test.setup_parser(subparser)
spack.cmd.test.test(parser, args, unknown_args)

spack.cmd.uninstall module

spack.cmd.uninstall.do_uninstall(specs, force)

Uninstalls all the specs in a list.

Parameters:
  • specs – list of specs to be uninstalled
  • force – force uninstallation (boolean)
spack.cmd.uninstall.find_matching_specs(specs, allow_multiple_matches=False, force=False)
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
Returns:

list of specs

spack.cmd.uninstall.get_uninstall_list(args)
spack.cmd.uninstall.installed_dependents(specs)

Returns a dictionary that maps a spec with a list of its installed dependents

Parameters:specs – list of specs to be checked for dependents
Returns:dictionary of installed dependents
spack.cmd.uninstall.setup_parser(subparser)
spack.cmd.uninstall.uninstall(parser, args)

spack.cmd.unload module

spack.cmd.unload.setup_parser(subparser)

Parser is only constructed so that this prints a nice help message with -h.

spack.cmd.unload.unload(parser, args)

spack.cmd.unuse module

spack.cmd.unuse.setup_parser(subparser)

Parser is only constructed so that this prints a nice help message with -h.

spack.cmd.unuse.unuse(parser, args)

spack.cmd.url module

spack.cmd.url.name_parsed_correctly(pkg, name)

Determine if the name of a package was correctly parsed.

Parameters:
Returns:

True if the name was correctly parsed, else False

Return type:

bool

spack.cmd.url.print_name_and_version(url)

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_separators(version)

Removes 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 Version) – A version
Returns:The version with all separator characters removed
Return type:str
spack.cmd.url.setup_parser(subparser)
spack.cmd.url.url(parser, args)
spack.cmd.url.url_list(args)
spack.cmd.url.url_list_parsing(args, urls, url, pkg)

Helper function for url_list().

Parameters:
  • args (argparse.Namespace) – The arguments given to spack url list
  • urls (set) – List of URLs that have already been added
  • url (str or None) – A URL to potentially add to urls depending on args
  • pkg (spack.package.PackageBase) – The Spack package
Returns:

The updated set of urls

Return type:

set

spack.cmd.url.url_parse(args)
spack.cmd.url.url_summary(args)
spack.cmd.url.version_parsed_correctly(pkg, version)

Determine if the version of a package was correctly parsed.

Parameters:
Returns:

True if the name was correctly parsed, else False

Return type:

bool

spack.cmd.use module

spack.cmd.use.setup_parser(subparser)

Parser is only constructed so that this prints a nice help message with -h.

spack.cmd.use.use(parser, args)

spack.cmd.versions module

spack.cmd.versions.setup_parser(subparser)
spack.cmd.versions.versions(parser, args)

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 depenencies of the seeds unless user specifies –no-depenencies
  • less 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 imspired by Nix, implemented by brett.viren@gmail.com ca 2016.

spack.cmd.view.assuredir(path)

Assure path exists as a directory

spack.cmd.view.check_one(spec, path, verbose=False)

Check status of view in path against spec

spack.cmd.view.filter_exclude(specs, exclude)

Filter specs given sequence of exclude regex

spack.cmd.view.flatten(seeds, descend=True)

Normalize and flattend seed specs and descend hiearchy

Link all files in spec into directory path.

spack.cmd.view.purge_empty_directories(path)

Ascend up from the leaves accessible from path and remove empty directories.

spack.cmd.view.relative_to(prefix, path)

Return end of path relative to prefix

spack.cmd.view.remove_one(spec, path, verbose=False)

Remove any files found in spec from path and purge empty directories.

spack.cmd.view.setup_parser(sp)
spack.cmd.view.transform_path(spec, path, prefix=None)

Return the a relative path corresponding to given path spec.prefix

spack.cmd.view.view(parser, args)

Produce a view of a set of packages.

spack.cmd.view.visitor_add(specs, args)

Symlink all files found in specs

spack.cmd.view.visitor_check(specs, args)

Give status of view in args.path relative to specs

spack.cmd.view.visitor_hard(specs, args)

Hardlink all files found in specs

Hardlink all files found in specs

spack.cmd.view.visitor_remove(specs, args)

Remove all files and directories found in specs from args.path

spack.cmd.view.visitor_rm(specs, args)

Remove all files and directories found in specs from args.path

spack.cmd.view.visitor_soft(specs, args)

Symlink all files found in specs

Give status of view in args.path relative to specs

spack.cmd.view.visitor_status(specs, args)

Give status of view in args.path relative to specs

Symlink all files found in specs

Module contents

spack.cmd.disambiguate_spec(spec)
spack.cmd.display_specs(specs, args=None, **kwargs)

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. There are three possible “modes”:

  • short (default): short specs with name and version, columnized
  • paths: Two columns: one for specs, one for paths
  • deps: Dependency-tree style, like spack spec; can get long

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 of spack.spec.Spec) – the specs to display
  • args (optional argparse.Namespace) – namespace containing formatting arguments
Keyword Arguments:
 
  • mode (str) – Either ‘short’, ‘paths’, or ‘deps’
  • long (bool) – Display short hashes with specs
  • very_long (bool) – Display full hashes with specs (supersedes long)
  • namespace (bool) – Print namespaces along with names
  • show_flags (bool) – Show compiler flags with specs
  • variants (bool) – Show variants with specs
spack.cmd.elide_list(line_list, max_num=10)

Takes a long list and limits it to a smaller number of elements, replacing intervening elements with ‘...’. For example:

elide_list([1,2,3,4,5,6], 4)

gives:

[1, 2, 3, '...', 6]
spack.cmd.get_command(name)

Imports the command’s function from a module and returns it.

spack.cmd.get_module(name)

Imports the module for a particular command name and returns it.

spack.cmd.get_python_name(name)

Commands can have ‘-‘ in their names, unlike Python identifiers.

spack.cmd.gray_hash(spec, length)
spack.cmd.parse_specs(args, **kwargs)

Convenience function for parsing arguments from specs. Handles common exceptions and dies if there are errors.

spack.cmd.remove_options(parser, *options)

Remove some options from a parser.