spack.hooks package

Submodules

spack.hooks.extensions module

spack.hooks.extensions.pre_uninstall(spec)

spack.hooks.licensing module

spack.hooks.licensing.post_install(spec)

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

spack.hooks.licensing.pre_install(spec)

This hook handles global license setup for licensed software.

spack.hooks.licensing.set_up_license(pkg)

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.module_file_generation.post_install(spec)
spack.hooks.module_file_generation.post_uninstall(spec)

spack.hooks.permissions_setters module

spack.hooks.permissions_setters.post_install(spec)

spack.hooks.sbang module

spack.hooks.sbang.filter_shebang(path)

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

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

Ensure that sbang is installed in the root of Spack’s install_tree.

This is the shortest known publicly accessible path, and installing sbang here ensures that users can access the script and that sbang itself is in a short path.

spack.hooks.sbang.post_install(spec)

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

spack.hooks.sbang.sbang_install_path()

Location sbang should be installed within Spack’s install_tree.

spack.hooks.sbang.shebang_limit = 127

Character limit for shebang line. Using Linux’s 127 characters here, as it is the shortest I could find on a modern OS.

spack.hooks.sbang.shebang_too_long(path)

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

spack.hooks.write_install_manifest module

spack.hooks.write_install_manifest.post_install(spec)

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_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, lmod, etc.) or to add other custom features.

class spack.hooks.HookRunner(hook_name)

Bases: object

spack.hooks.all_hook_modules()