spack.hooks package


spack.hooks.extensions module


spack.hooks.licensing module


This hook symlinks local licenses to the global license for licensed software.


This hook handles global license setup for licensed software.


Prompt the user, letting them know that a license is required.

For packages that rely on license files, a global license file is created and opened for editing.

For packages that rely on environment variables to point to a license, a warning message is printed.

For all other packages, documentation on how to set up a license is printed.

Create local symlinks that point to the global license file.

spack.hooks.licensing.write_license_file(pkg, license_path)

Writes empty license file.

Comments give suggestions on alternative methods of installing a license.

spack.hooks.module_file_generation module


spack.hooks.permissions_setters module

exception spack.hooks.permissions_setters.InvalidPermissionsError(message, long_message=None)

ベースクラス: spack.error.SpackError

Error class for invalid permission setters

spack.hooks.permissions_setters.chmod_real_entries(path, perms)
spack.hooks.permissions_setters.forall_files(path, fn, args, dir_args=None)

Apply function to all files in directory, with file as first arg.

Does not apply to the root dir. Does not apply to links


spack.hooks.sbang module


Adds a second shebang line, using sbang, at the beginning of a file.

spack.hooks.sbang.filter_shebangs_in_directory(directory, filenames=None)

This hook edits scripts so that they call /bin/bash $spack_prefix/bin/sbang instead of something longer than the shebang limit.


Detects whether a file has a shebang line that is too long.

spack.hooks.yaml_version_check module

Yaml Version Check is a module for ensuring that config file formats are compatible with the current version of Spack.


Module contents

This package contains modules with hooks for various stages in the Spack install process. You can add modules here and they'll be executed by package at various times during the package lifecycle.

Each hook is just a function that takes a package as a parameter. Hooks are not executed in any particular order.

Currently the following hooks are supported:

  • pre_run()

  • pre_install(spec)

  • post_install(spec)

  • pre_uninstall(spec)

  • post_uninstall(spec)

This can be used to implement support for things like module systems (e.g. modules, dotkit, etc.) or to add other custom features.

class spack.hooks.HookRunner(hook_name)

ベースクラス: object