spack.build_systems package

Submodules

spack.build_systems.aspell_dict module

class spack.build_systems.aspell_dict.AspellBuilder(pkg)[source]

Bases: AutotoolsBuilder

The Aspell builder is close enough to an autotools builder to allow specializing the builder class, so to use variables that are specific to the Aspell extensions.

configure(pkg, spec, prefix)[source]

Run “configure”, with the arguments specified by the builder and an appropriately set prefix.

run_after_callbacks = [(('autoreconf', None), <function AutotoolsBuilder._do_patch_config_files>), (('configure', None), <function AutotoolsBuilder._do_patch_libtool>), (('autoreconf', None), <function AutotoolsBuilder.set_configure_or_die>), (('build', None), <function execute_build_time_tests>), (('install', None), <function execute_install_time_tests>), (('install', None), <function AutotoolsBuilder.remove_libtool_archives>), (('install', 'platform=darwin'), <function apply_macos_rpath_fixups>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = [(('configure', None), <function AutotoolsBuilder._patch_usr_bin_file>), (('configure', None), <function AutotoolsBuilder._set_autotools_environment_variables>), (('configure', None), <function AutotoolsBuilder._do_patch_libtool_configure>), (('autoreconf', None), <function AutotoolsBuilder.delete_configure_to_force_update>)]
class spack.build_systems.aspell_dict.AspellDictPackage(spec)[source]

Bases: AutotoolsPackage

Specialized class for building aspell dictionairies.

AutotoolsBuilder

Override the default autotools builder

alias of AspellBuilder

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
patch()[source]
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict
view_destination(view)[source]

The target root directory: each file is added relative to this directory.

view_source()[source]

The source root directory that will be added to the view: files are added such that their path relative to the view destination matches their path relative to the view source.

spack.build_systems.autotools module

class spack.build_systems.autotools.AutotoolsBuilder(pkg)[source]

Bases: BaseBuilder

The autotools builder encodes the default way of installing software built with autotools. It has four phases that can be overridden, if need be:

They all have sensible defaults and for many packages the only thing necessary is to override the helper method configure_args().

For a finer tuning you may also override:

Method

Purpose

build_targets

Specify make targets for the build phase

install_targets

Specify make targets for the install phase

check()

Run build time tests if required

property archive_files

Files to archive for packages based on autotools

autoreconf(pkg, spec, prefix)[source]

Not needed usually, configure should be already there

autoreconf_extra_args: List[str] = []

Options to be passed to autoreconf when using the default implementation

property autoreconf_search_path_args

Search path includes for autoreconf. Add an -I flag for all aclocal dirs of build deps, skips the default path of automake, move external include flags to the back, since they might pull in unrelated m4 files shadowing spack dependencies.

build(pkg, spec, prefix)[source]

Run “make” on the build targets specified by the builder.

property build_directory

Override to provide another place to build the package

build_system: str | None = 'autotools'

Build system name. Must also be defined in derived classes.

build_targets: List[str] = []

Targets for make during the build() phase

build_time_test_callbacks: List[str] = ['check']

Callback names for build-time test

check()[source]

Run “make” on the test and check targets, if found.

configure(pkg, spec, prefix)[source]

Run “configure”, with the arguments specified by the builder and an appropriately set prefix.

property configure_abs_path
configure_args()[source]

Return the list of all the arguments that must be passed to configure, except --prefix which will be pre-pended to the list.

property configure_directory

Return the directory where ‘configure’ resides.

delete_configure_to_force_update()[source]
enable_or_disable(name, activation_value=None, variant=None)[source]

Same as with_or_without() but substitute with with enable and without with disable.

Parameters:
  • name (str) – name of a valid multi-valued variant

  • activation_value (Callable) –

    if present accepts a single value and returns the parameter to be used leading to an entry of the type --enable-{name}={parameter}

    The special value ‘prefix’ can also be assigned and will return spec[name].prefix as activation parameter.

Returns:

list of arguments to configure

force_autoreconf = False

Set to true to force the autoreconf step even if configure is present

install(pkg, spec, prefix)[source]

Run “make” on the install targets specified by the builder.

install_libtool_archives = False

If False deletes all the .la files in the prefix folder after the installation. If True instead it installs them.

install_targets = ['install']

Targets for make during the install() phase

install_time_test_callbacks: List[str] = ['installcheck']

Callback names for install-time test

installcheck()[source]

Run “make” on the installcheck target, if found.

legacy_attributes: Tuple[str, ...] = ('archive_files', 'patch_libtool', 'build_targets', 'install_targets', 'build_time_test_callbacks', 'install_time_test_callbacks', 'force_autoreconf', 'autoreconf_extra_args', 'install_libtool_archives', 'patch_config_files', 'configure_directory', 'configure_abs_path', 'build_directory', 'autoreconf_search_path_args')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('configure_args', 'check', 'installcheck')

Names associated with package methods in the old build-system format

property patch_config_files

Whether to update old config.guess and config.sub files distributed with the tarball.

This currently only applies to ppc64le:, aarch64:, and riscv64 target architectures.

The substitutes are taken from the gnuconfig package, which is automatically added as a build dependency for these architectures. In case system versions of these config files are required, the gnuconfig package can be marked external, with a prefix pointing to the directory containing the system config.guess and config.sub files.

patch_libtool = True

Whether to update libtool (e.g. for Arm/Clang/Fujitsu/NVHPC compilers)

phases: Tuple[str, ...] = ('autoreconf', 'configure', 'build', 'install')

Phases of a GNU Autotools package

remove_libtool_archives()[source]

Remove all .la files in prefix sub-folders if the package sets install_libtool_archives to be False.

run_after_callbacks = [(('autoreconf', None), <function AutotoolsBuilder._do_patch_config_files>), (('configure', None), <function AutotoolsBuilder._do_patch_libtool>), (('autoreconf', None), <function AutotoolsBuilder.set_configure_or_die>), (('build', None), <function execute_build_time_tests>), (('install', None), <function execute_install_time_tests>), (('install', None), <function AutotoolsBuilder.remove_libtool_archives>), (('install', 'platform=darwin'), <function apply_macos_rpath_fixups>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = [(('configure', None), <function AutotoolsBuilder._patch_usr_bin_file>), (('configure', None), <function AutotoolsBuilder._set_autotools_environment_variables>), (('configure', None), <function AutotoolsBuilder._do_patch_libtool_configure>), (('autoreconf', None), <function AutotoolsBuilder.delete_configure_to_force_update>)]
set_configure_or_die()[source]

Ensure the presence of a “configure” script, or raise. If the “configure” is found, a module level attribute is set.

Raises:

RuntimeError – if the “configure” script is not found

setup_build_environment(env)[source]

Sets up the build environment for a package.

This method will be called before the current package prefix exists in Spack’s store.

Parameters:

env (spack.util.environment.EnvironmentModifications) – environment modifications to be applied when the package is built. Package authors can call methods on it to alter the build environment.

with_or_without(name, activation_value=None, variant=None)[source]

Inspects a variant and returns the arguments that activate or deactivate the selected feature(s) for the configure options.

This function works on all type of variants. For bool-valued variants it will return by default --with-{name} or --without-{name}. For other kinds of variants it will cycle over the allowed values and return either --with-{value} or --without-{value}.

If activation_value is given, then for each possible value of the variant, the option --with-{value}=activation_value(value) or --without-{value} will be added depending on whether or not variant=value is in the spec.

Parameters:
  • name (str) – name of a valid multi-valued variant

  • activation_value (Callable) –

    callable that accepts a single value and returns the parameter to be used leading to an entry of the type --with-{name}={parameter}.

    The special value ‘prefix’ can also be assigned and will return spec[name].prefix as activation parameter.

Returns:

list of arguments to configure

class spack.build_systems.autotools.AutotoolsPackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using GNU Autotools.

build_system_class = 'AutotoolsPackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
enable_or_disable(*args, **kwargs)[source]
flags_to_build_system_args(flags)[source]

Produces a list of all command line arguments to pass specified compiler flags to configure.

languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'autotools'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict
with_or_without(*args, **kwargs)[source]

spack.build_systems.bundle module

class spack.build_systems.bundle.BundleBuilder(pkg)[source]

Bases: Builder

build_system: str | None = 'bundle'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str]
install(pkg, spec, prefix)[source]
install_time_test_callbacks: List[str]
phases: Tuple[str, ...] = ('install',)

Sequence of phases. Must be defined in derived classes

run_after_callbacks = []
run_before_callbacks = []
class spack.build_systems.bundle.BundlePackage(spec)[source]

Bases: PackageBase

General purpose bundle, or no-code, package class.

build_system_class = 'BundlePackage'

This attribute is used in UI queries that require to know which build-system class we are using

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
has_code = False

Bundle packages do not have associated source or binary code.

languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'bundle'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.cached_cmake module

class spack.build_systems.cached_cmake.CachedCMakeBuilder(pkg)[source]

Bases: CMakeBuilder

property cache_name
property cache_path
define_cmake_cache_from_variant(cmake_var, variant=None, comment='')[source]

Return a Cached CMake field from the given variant’s value. See define_from_variant in lib/spack/spack/build_systems/cmake.py package

initconfig(pkg, spec, prefix)[source]
initconfig_compiler_entries()[source]
initconfig_hardware_entries()[source]
initconfig_mpi_entries()[source]
initconfig_package_entries()[source]

This method is to be overwritten by the package

install_cmake_cache()[source]
legacy_attributes: Tuple[str, ...] = ('build_targets', 'install_targets', 'build_time_test_callbacks', 'archive_files', 'root_cmakelists_dir', 'std_cmake_args', 'build_dirname', 'build_directory', 'cache_name', 'cache_path')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('cmake_args', 'check', 'initconfig_compiler_entries', 'initconfig_mpi_entries', 'initconfig_hardware_entries', 'std_initconfig_entries', 'initconfig_package_entries')

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('initconfig', 'cmake', 'build', 'install')

Phases of a Cached CMake package Note: the initconfig phase is used for developer builds as a final phase to stop on

run_after_callbacks = [(('install', None), <function CachedCMakeBuilder.install_cmake_cache>), (('build', None), <function execute_build_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
property std_cmake_args

Standard cmake arguments provided as a property for convenience of package writers

std_initconfig_entries()[source]
class spack.build_systems.cached_cmake.CachedCMakePackage(spec)[source]

Bases: CMakePackage

Specialized class for packages built using CMake initial cache.

This feature of CMake allows packages to increase reproducibility, especially between Spack- and manual builds. It also allows packages to sidestep certain parsing bugs in extremely long cmake commands, and to avoid system limits on the length of the command line.

CMakeBuilder

alias of CachedCMakeBuilder

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
flag_handler(name, flags)[source]
languages: Dict[spack.spec.Spec, Set[str]]
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict
spack.build_systems.cached_cmake.cmake_cache_filepath(name, value, comment='')[source]

Generate a string for a cmake cache variable of type FILEPATH

spack.build_systems.cached_cmake.cmake_cache_option(name, boolean_value, comment='', force=False)[source]

Generate a string for a cmake configuration option

spack.build_systems.cached_cmake.cmake_cache_path(name, value, comment='', force=False)[source]

Generate a string for a cmake cache variable

spack.build_systems.cached_cmake.cmake_cache_string(name, value, comment='', force=False)[source]

Generate a string for a cmake cache variable

spack.build_systems.cargo module

class spack.build_systems.cargo.CargoBuilder(pkg)[source]

Bases: BaseBuilder

The Cargo builder encodes the most common way of building software with a rust Cargo.toml file. It has two phases that can be overridden, if need be:

For a finer tuning you may override:

Method

Purpose

build_args()

Specify arguments to cargo install

check_args()

Specify arguments to cargo test

build(pkg, spec, prefix)[source]

Runs cargo install in the source directory

property build_args

Arguments for cargo build.

property build_directory

Return the directory containing the main Cargo.toml.

build_system: str | None = 'cargo'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str]
check()[source]

Run “cargo test”.

property check_args

Argument for cargo test during check phase

install(pkg, spec, prefix)[source]

Copy build files into package prefix.

install_time_test_callbacks: List[str] = ['check']

Callback names for install-time test

phases: Tuple[str, ...] = ('build', 'install')

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('install', None), <function execute_install_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.cargo.CargoPackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using a Makefiles.

build_system_class = 'CargoPackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.cmake module

class spack.build_systems.cmake.CMakeBuilder(pkg)[source]

Bases: BaseBuilder

The cmake builder encodes the default way of building software with CMake. IT has three phases that can be overridden:

They all have sensible defaults and for many packages the only thing necessary will be to override cmake_args().

For a finer tuning you may also override:

Method

Purpose

root_cmakelists_dir()

Location of the root CMakeLists.txt

build_directory()

Directory where to build the package

property archive_files

Files to archive for packages based on CMake

build(pkg, spec, prefix)[source]

Make the build targets

property build_directory

Full-path to the directory to use when building the package.

property build_dirname

Directory name to use when building the package.

build_system: str | None = 'cmake'

Build system name. Must also be defined in derived classes.

build_targets: List[str] = []

Targets to be used during the build phase

build_time_test_callbacks: List[str] = ['check']

Callback names for build-time test

check()[source]

Search the CMake-generated files for the targets test and check, and runs them if found.

cmake(pkg, spec, prefix)[source]

Runs cmake in the build directory

cmake_args()[source]

List of all the arguments that must be passed to cmake, except:

  • CMAKE_INSTALL_PREFIX

  • CMAKE_BUILD_TYPE

which will be set automatically.

static define(cmake_var, value)[source]

Return a CMake command line argument that defines a variable.

The resulting argument will convert boolean values to OFF/ON and lists/tuples to CMake semicolon-separated string lists. All other values will be interpreted as strings.

Examples

[define('BUILD_SHARED_LIBS', True),
 define('CMAKE_CXX_STANDARD', 14),
 define('swr', ['avx', 'avx2'])]

will generate the following configuration options:

["-DBUILD_SHARED_LIBS:BOOL=ON",
 "-DCMAKE_CXX_STANDARD:STRING=14",
 "-DSWR:STRING=avx;avx2]
static define_cuda_architectures(pkg)[source]

Returns the str -DCMAKE_CUDA_ARCHITECTURES:STRING=(expanded cuda_arch).

cuda_arch is variant composed of a list of target CUDA architectures and it is declared in the cuda package.

This method is no-op for cmake<3.18 and when cuda_arch variant is not set.

define_from_variant(cmake_var, variant=None)[source]

Return a CMake command line argument from the given variant’s value.

The optional variant argument defaults to the lower-case transform of cmake_var.

This utility function is similar to with_or_without().

Examples

Given a package with:

variant('cxxstd', default='11', values=('11', '14'),
        multi=False, description='')
variant('shared', default=True, description='')
variant('swr', values=any_combination_of('avx', 'avx2'),
        description='')

calling this function like:

[self.define_from_variant('BUILD_SHARED_LIBS', 'shared'),
 self.define_from_variant('CMAKE_CXX_STANDARD', 'cxxstd'),
 self.define_from_variant('SWR')]

will generate the following configuration options:

["-DBUILD_SHARED_LIBS:BOOL=ON",
 "-DCMAKE_CXX_STANDARD:STRING=14",
 "-DSWR:STRING=avx;avx2]

for <spec-name> cxxstd=14 +shared swr=avx,avx2

Note: if the provided variant is conditional, and the condition is not met,

this function returns an empty string. CMake discards empty strings provided on the command line.

static define_hip_architectures(pkg)[source]

Returns the str -DCMAKE_HIP_ARCHITECTURES:STRING=(expanded amdgpu_target).

amdgpu_target is variant composed of a list of the target HIP architectures and it is declared in the rocm package.

This method is no-op for cmake<3.18 and when amdgpu_target variant is not set.

property generator
install(pkg, spec, prefix)[source]

Make the install targets

install_targets = ['install']

Targets to be used during the install phase

legacy_attributes: Tuple[str, ...] = ('build_targets', 'install_targets', 'build_time_test_callbacks', 'archive_files', 'root_cmakelists_dir', 'std_cmake_args', 'build_dirname', 'build_directory')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('cmake_args', 'check')

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('cmake', 'build', 'install')

Phases of a CMake package

property root_cmakelists_dir

The relative path to the directory containing CMakeLists.txt

This path is relative to the root of the extracted tarball, not to the build_directory. Defaults to the current directory.

run_after_callbacks = [(('build', None), <function execute_build_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
static std_args(pkg, generator=None)[source]

Computes the standard cmake arguments for a generic package

property std_cmake_args

Standard cmake arguments provided as a property for convenience of package writers

class spack.build_systems.cmake.CMakePackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using CMake

For more information on the CMake build system, see: https://cmake.org/cmake/help/latest/

build_system_class = 'CMakePackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
define(*args, **kwargs)[source]
define_from_variant(*args, **kwargs)[source]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
find_python_hints = True

When this package depends on Python and find_python_hints is set to True, pass the defines {Python3,Python,PYTHON}_EXECUTABLE explicitly, so that CMake locates the right Python in its builtin FindPython3, FindPython, and FindPythonInterp modules. Spack does CMake’s job because CMake’s modules by default only search for Python versions known at the time of release.

flags_to_build_system_args(flags)[source]

Return a list of all command line arguments to pass the specified compiler flags to cmake. Note CMAKE does not have a cppflags option, so cppflags will be added to cflags, cxxflags, and fflags to mimic the behavior in other tools.

languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'cmake'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict
spack.build_systems.cmake.generator(*names: str, default: str | None = None)[source]

The build system generator to use.

See cmake --help for a list of valid generators. Currently, “Unix Makefiles” and “Ninja” are the only generators that Spack supports. Defaults to “Unix Makefiles”.

See https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html for more information.

Parameters:
  • names – allowed generators for this package

  • default – default generator

spack.build_systems.cuda module

class spack.build_systems.cuda.CudaPackage(spec)[source]

Bases: PackageBase

Auxiliary class which contains CUDA variant, dependencies and conflicts and is meant to unify and facilitate its usage.

Maintainers: ax3l, Rombur, davidbeckingsale

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
cuda_arch_values = ('10', '11', '12', '13', '20', '21', '30', '32', '35', '37', '50', '52', '53', '60', '61', '62', '70', '72', '75', '80', '86', '87', '89', '90')
static cuda_flags(arch_list)[source]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.generic module

class spack.build_systems.generic.GenericBuilder(pkg)[source]

Bases: BaseBuilder

A builder for a generic build system, that require packagers to implement an “install” phase.

build_system: str | None = 'generic'

Build system name. Must also be defined in derived classes.

install_time_test_callbacks: List[str] = []

Callback names for post-install phase tests

legacy_attributes: Tuple[str, ...] = ('archive_files', 'install_time_test_callbacks')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ()

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('install',)

A generic package has only the “install” phase

run_after_callbacks = [(('install', 'platform=darwin'), <function apply_macos_rpath_fixups>), (('install', None), <function execute_install_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.generic.Package(spec)[source]

Bases: PackageBase

General purpose class with a single install phase that needs to be coded by packagers.

build_system_class = 'Package'

This attribute is used in UI queries that require to know which build-system class we are using

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'generic'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.gnu module

class spack.build_systems.gnu.GNUMirrorPackage(spec)[source]

Bases: PackageBase

Mixin that takes care of setting url and mirrors for GNU packages.

base_mirrors = ['https://ftpmirror.gnu.org/', 'https://ftp.gnu.org/gnu/', 'http://ftpmirror.gnu.org/']

List of GNU mirrors used by Spack

gnu_mirror_path: str | None = None

Path of the package in a GNU mirror

run_after_callbacks = []
run_before_callbacks = []
property urls

spack.build_systems.go module

class spack.build_systems.go.GoBuilder(pkg)[source]

Bases: BaseBuilder

The Go builder encodes the most common way of building software with a golang go.mod file. It has two phases that can be overridden, if need be:

For a finer tuning you may override:

Method

Purpose

build_args()

Specify arguments to go build

check_args()

Specify arguments to go test

build(pkg, spec, prefix)[source]

Runs go build in the source directory

property build_args

Arguments for go build.

property build_directory

Return the directory containing the main go.mod.

build_system: str | None = 'go'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str]
check()[source]

Run go test . in the source directory

property check_args

Argument for go test during check phase

install(pkg, spec, prefix)[source]

Install built binaries into prefix bin.

install_time_test_callbacks: List[str] = ['check']

Callback names for install-time test

phases: Tuple[str, ...] = ('build', 'install')

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('install', None), <function execute_install_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
setup_build_environment(env)[source]

Sets up the build environment for a package.

This method will be called before the current package prefix exists in Spack’s store.

Parameters:

env (spack.util.environment.EnvironmentModifications) – environment modifications to be applied when the package is built. Package authors can call methods on it to alter the build environment.

class spack.build_systems.go.GoPackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using the Go toolchain.

build_system_class = 'GoPackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'go'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.intel module

class spack.build_systems.intel.IntelPackage(spec)[source]

Bases: Package

Specialized class for licensed Intel software.

This class provides two phases that can be overridden:

  1. configure()

  2. install()

They both have sensible defaults and for many packages the only thing necessary will be to override setup_run_environment to set the appropriate environment variables.

auto_dispatch_options = ('COMMON-AVX512', 'MIC-AVX512', 'CORE-AVX512', 'CORE-AVX2', 'CORE-AVX-I', 'AVX', 'SSE4.2', 'SSE4.1', 'SSSE3', 'SSE3', 'SSE2')
property base_lib_dir

Provide the library directory located in the base of Intel installation.

property blas_libs
build_system_class = 'IntelPackage'

This attribute is used in UI queries that need to know the build system base class

component_bin_dir(component, **kwargs)[source]
component_include_dir(component, **kwargs)[source]
component_lib_dir(component, **kwargs)[source]

Provide directory suitable for find_libraries() and SPACK_COMPILER_EXTRA_RPATHS.

configure()[source]

Generates the silent.cfg file to pass to installer.sh.

See https://software.intel.com/en-us/articles/configuration-file-format

configure_auto_dispatch()[source]
configure_rpath()[source]
conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
property file_to_source

Full path of file to source for initializing an Intel package. A client package could override as follows: ` @property` ` def file_to_source(self):` ` return self.normalize_path(“apsvars.sh”, “vtune_amplifier”)`

filter_compiler_wrappers()[source]
property global_license_file

Returns the path where a Spack-global license file should be stored.

All Intel software shares the same license, so we store it in a common ‘intel’ directory.

property headers
install(spec, prefix)[source]

Runs Intel’s install.sh installation script. Afterwards, save the installer config and logs to <prefix>/.spack

property intel64_int_suffix

Provide the suffix for Intel library names to match a client application’s desired int size, conveyed by the active spec variant. The possible suffixes and their meanings are:

ilp64 all of int, long, and pointer are 64 bit, `` lp64`` only long and pointer are 64 bit; int will be 32bit.

languages: Dict[spack.spec.Spec, Set[str]]
property lapack_libs
property libs
license_comment = '#'

Comment symbol used in the license.lic file

property license_files

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

property license_required

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

license_url = 'https://software.intel.com/en-us/articles/intel-license-manager-faq'

URL providing information on how to acquire a license key

license_vars: List[str] = ['INTEL_LICENSE_FILE']

Environment variables that Intel searches for a license file

modify_LLVMgold_rpath()[source]

Add libimf.so and other required libraries to the RUNPATH of LLVMgold.so.

These are needed explicitly at dependent link time when ld -plugin LLVMgold.so is called by the compiler.

property mpi_compiler_wrappers

Return paths to compiler wrappers as a dict of env-like names

mpi_setup_dependent_build_environment(env, dependent_spec, compilers_of_client={})[source]

Unified back-end for setup_dependent_build_environment() of Intel packages that provide ‘mpi’.

Parameters:
  • env – same as in setup_dependent_build_environment().

  • dependent_spec – same as in setup_dependent_build_environment().

  • compilers_of_client (dict) – Conveys spack_cc, spack_cxx, etc., from the scope of dependent packages; constructed in caller.

normalize_path(component_path, component_suite_dir=None, relative=False)[source]

Returns the absolute or relative path to a component or file under a component suite directory.

Intel’s product names, scope, and directory layout changed over the years. This function provides a unified interface to their directory names.

Parameters:
  • component_path (str) – a component name like ‘mkl’, or ‘mpi’, or a deeper relative path.

  • component_suite_dir (str) –

    _Unversioned_ name of the expected parent directory of component_path. When absent or None, an appropriate default will be used. A present but empty string “” requests that component_path refer to self.prefix directly.

    Typical values: compilers_and_libraries, composer_xe, parallel_studio_xe.

    Also supported: advisor, inspector, vtune. The actual directory name for these suites varies by release year. The name will be corrected as needed for use in the return value.

  • relative (bool) – When True, return path relative to self.prefix, otherwise, return an absolute path (the default).

normalize_suite_dir(suite_dir_name, version_globs=['*.*.*'])[source]

Returns the version-specific and absolute path to the directory of an Intel product or a suite of product components.

Parameters:
  • suite_dir_name (str) –

    Name of the product directory, without numeric version.

    • Examples:

      composer_xe, parallel_studio_xe, compilers_and_libraries
      

    The following will work as well, even though they are not directly targets for Spack installation:

    advisor_xe, inspector_xe, vtune_amplifier_xe,
    performance_snapshots (new name for vtune as of 2018)
    

    These are single-component products without subordinate components and are normally made available to users by a toplevel psxevars.sh or equivalent file to source (and thus by the modulefiles that Spack produces).

  • version_globs (list) – Suffix glob patterns (most specific first) expected to qualify suite_dir_name to its fully version-specific install directory (as opposed to a compatibility directory or symlink).

property openmp_libs

Supply LibraryList for linking OpenMP

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
property pset_components
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = [(('install', None), <function IntelPackage.validate_install>), (('install', None), <function IntelPackage.configure_rpath>), (('install', None), <function IntelPackage.configure_auto_dispatch>), (('install', None), <function IntelPackage.filter_compiler_wrappers>), (('install', None), <function IntelPackage.uninstall_ism>), (('install', None), <function IntelPackage.modify_LLVMgold_rpath>)]
run_before_callbacks = [(('install', None), <function IntelPackage.configure>)]
property scalapack_libs
setup_dependent_build_environment(env, dependent_spec)[source]
setup_dependent_package(module, dep_spec)[source]

Set up Python module-scope variables for dependent packages.

Called before the install() method of dependents.

Default implementation does nothing, but this can be overridden by an extendable package to set up the module of its extensions. This is useful if there are some common steps to installing all extensions for a certain package.

Examples:

  1. Extensions often need to invoke the python interpreter from the Python installation being extended. This routine can put a python() Executable object in the module scope for the extension package to simplify extension installs.

  2. MPI compilers could set some variables in the dependent’s scope that point to mpicc, mpicxx, etc., allowing them to be called by common name regardless of which MPI is used.

  3. BLAS/LAPACK implementations can set some variables indicating the path to their libraries, since these paths differ by BLAS/LAPACK implementation.

Parameters:
  • module (spack.package_base.PackageBase.module) – The Python module object of the dependent package. Packages can use this to set module-scope variables for the dependent to use.

  • dependent_spec (spack.spec.Spec) – The spec of the dependent package about to be built. This allows the extendee (self) to query the dependent’s state. Note that this package’s spec is available as self.spec.

setup_run_environment(env)[source]

Adds environment variables to the generated module file.

These environment variables come from running:

$ source parallel_studio_xe_2017/bin/psxevars.sh intel64
[and likewise for MKL, MPI, and other components]
spec: spack.spec.Spec
property tbb_headers
property tbb_libs

Supply LibraryList for linking TBB

uninstall_ism()[source]
validate_install()[source]
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
property version_yearlike

Return the version in a unified style, suitable for Version class conditionals.

version_years = {'intel-ipp@9.0:9': 2016, 'intel-mkl@11.3.0:11.3': 2016, 'intel-mpi@5.1:5': 2016}
versions: dict
spack.build_systems.intel.debug_print(msg, *args)[source]

Prints a message (usu. a variable) and the callers’ names for a couple of stack frames.

spack.build_systems.intel.raise_lib_error(*args)[source]

Bails out with an error message. Shows args after the first as one per line, tab-indented, useful for long paths to line up and stand out.

spack.build_systems.lua module

class spack.build_systems.lua.LuaBuilder(pkg)[source]

Bases: Builder

build_system: str | None = 'lua'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str]
generate_luarocks_config(pkg, spec, prefix)[source]
install(pkg, spec, prefix)[source]
install_time_test_callbacks: List[str]
legacy_attributes: Tuple[str, ...] = ()

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('luarocks_args',)

Names associated with package methods in the old build-system format

luarocks_args()[source]
phases: Tuple[str, ...] = ('unpack', 'generate_luarocks_config', 'preprocess', 'install')

Sequence of phases. Must be defined in derived classes

preprocess(pkg, spec, prefix)[source]

Override this to preprocess source before building with luarocks

run_after_callbacks = []
run_before_callbacks = []
setup_build_environment(env)[source]

Sets up the build environment for a package.

This method will be called before the current package prefix exists in Spack’s store.

Parameters:

env (spack.util.environment.EnvironmentModifications) – environment modifications to be applied when the package is built. Package authors can call methods on it to alter the build environment.

unpack(pkg, spec, prefix)[source]
class spack.build_systems.lua.LuaPackage(spec)[source]

Bases: PackageBase

Specialized class for lua packages

build_system_class = 'LuaPackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'lua'

Legacy buildsystem attribute used to deserialize and install old specs

list_depth = 1

Link depth to which list_url should be searched for new versions

property lua
property luarocks
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.makefile module

class spack.build_systems.makefile.MakefileBuilder(pkg)[source]

Bases: BaseBuilder

The Makefile builder encodes the most common way of building software with Makefiles. It has three phases that can be overridden, if need be:

It is usually necessary to override the edit() phase (which is by default a no-op), while the other two have sensible defaults.

For a finer tuning you may override:

Method

Purpose

build_targets

Specify make targets for the build phase

install_targets

Specify make targets for the install phase

build_directory()

Directory where the Makefile is located

build(pkg, spec, prefix)[source]

Run “make” on the build targets specified by the builder.

property build_directory

Return the directory containing the main Makefile.

build_system: str | None = 'makefile'

Build system name. Must also be defined in derived classes.

build_targets: List[str] = []

Targets for make during the build() phase

build_time_test_callbacks: List[str] = ['check']

Callback names for build-time test

check()[source]

Run “make” on the test and check targets, if found.

edit(pkg, spec, prefix)[source]

Edit the Makefile before calling make. The default is a no-op.

install(pkg, spec, prefix)[source]

Run “make” on the install targets specified by the builder.

install_targets = ['install']

Targets for make during the install() phase

install_time_test_callbacks: List[str] = ['installcheck']

Callback names for install-time test

installcheck()[source]

Searches the Makefile for an installcheck target and runs it if found.

legacy_attributes: Tuple[str, ...] = ('build_targets', 'install_targets', 'build_time_test_callbacks', 'install_time_test_callbacks', 'build_directory')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('check', 'installcheck')

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('edit', 'build', 'install')

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('build', None), <function execute_build_time_tests>), (('install', None), <function execute_install_time_tests>), (('install', 'platform=darwin'), <function apply_macos_rpath_fixups>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.makefile.MakefilePackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using a Makefiles.

build_system_class = 'MakefilePackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'makefile'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.maven module

class spack.build_systems.maven.MavenBuilder(pkg)[source]

Bases: BaseBuilder

The Maven builder encodes the default way to build software with Maven. It has two phases that can be overridden, if need be:

build(pkg, spec, prefix)[source]

Compile code and package into a JAR file.

build_args()[source]

List of args to pass to build phase.

property build_directory

The directory containing the pom.xml file.

build_system: str | None = 'maven'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str]
install(pkg, spec, prefix)[source]

Copy to installation prefix.

install_time_test_callbacks: List[str]
legacy_attributes: Tuple[str, ...] = ('build_directory',)

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('build_args',)

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('build', 'install')

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.maven.MavenPackage(spec)[source]

Bases: PackageBase

Specialized class for packages that are built using the Maven build system. See https://maven.apache.org/index.html for more information.

build_system_class = 'MavenPackage'
conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'maven'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.meson module

class spack.build_systems.meson.MesonBuilder(pkg)[source]

Bases: BaseBuilder

The Meson builder encodes the default way to build software with Meson. The builder has three phases that can be overridden, if need be:

They all have sensible defaults and for many packages the only thing necessary will be to override meson_args().

For a finer tuning you may also override:

Method

Purpose

root_mesonlists_dir()

Location of the root MesonLists.txt

build_directory()

Directory where to build the package

property archive_files

Files to archive for packages based on Meson

build(pkg, spec, prefix)[source]

Make the build targets

property build_directory

Directory to use when building the package.

property build_dirname

Returns the directory name to use when building the package.

build_system: str | None = 'meson'

Build system name. Must also be defined in derived classes.

build_targets: List[str] = []
build_time_test_callbacks: List[str] = ['check']
check()[source]

Search Meson-generated files for the target test and run it if found.

install(pkg, spec, prefix)[source]

Make the install targets

install_targets = ['install']
legacy_attributes: Tuple[str, ...] = ('build_targets', 'install_targets', 'build_time_test_callbacks', 'root_mesonlists_dir', 'std_meson_args', 'build_directory')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('meson_args', 'check')

Names associated with package methods in the old build-system format

meson(pkg, spec, prefix)[source]

Run meson in the build directory

meson_args()[source]

List of arguments that must be passed to meson, except:

  • --prefix

  • --libdir

  • --buildtype

  • --strip

  • --default_library

which will be set automatically.

phases: Tuple[str, ...] = ('meson', 'build', 'install')

Sequence of phases. Must be defined in derived classes

property root_mesonlists_dir

Relative path to the directory containing meson.build

This path is relative to the root of the extracted tarball, not to the build_directory. Defaults to the current directory.

run_after_callbacks = [(('build', None), <function execute_build_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
static std_args(pkg)[source]

Standard meson arguments for a generic package.

property std_meson_args

Standard meson arguments provided as a property for convenience of package writers.

class spack.build_systems.meson.MesonPackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using Meson. For more information on the Meson build system, see https://mesonbuild.com/

build_system_class = 'MesonPackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
flags_to_build_system_args(flags)[source]

Produces a list of all command line arguments to pass the specified compiler flags to meson.

languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'meson'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.msbuild module

class spack.build_systems.msbuild.MSBuildBuilder(pkg)[source]

Bases: BaseBuilder

The MSBuild builder encodes the most common way of building software with Mircosoft’s MSBuild tool. It has two phases that can be overridden, if need be:

It is usually necessary to override the install() phase as many packages with MSBuild systems neglect to provide an install target. The default install phase will attempt to invoke an install target from MSBuild. If none exists, this will result in a build failure

For a finer tuning you may override:

Method

Purpose

build_targets

Specify msbuild targets for the build phase

install_targets

Specify msbuild targets for the install phase

build_directory()

Directory where the project sln/vcxproj is located

build(pkg, spec, prefix)[source]

Run “msbuild” on the build targets specified by the builder.

property build_directory

Return the directory containing the MSBuild solution or vcxproj.

build_system: str | None = 'msbuild'

Build system name. Must also be defined in derived classes.

build_targets: List[str] = []

Targets for make during the build() phase

define(msbuild_arg, value)[source]
define_targets(*targets)[source]
install(pkg, spec, prefix)[source]

Run “msbuild” on the install targets specified by the builder. This is INSTALL by default

install_targets: List[str] = ['INSTALL']

Targets for msbuild during the install() phase

msbuild_args()[source]

Define build arguments to MSbuild. This is an empty list by default. Individual packages should override to specify MSBuild args to command line PlatformToolset is already defined an can be controlled via the toolchain_version property

msbuild_install_args()[source]

Define install arguments to MSBuild outside of the INSTALL target. This is the same as msbuild_args by default.

phases: Tuple[str, ...] = ('build', 'install')

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
property std_msbuild_args

Return common msbuild cl arguments, for now just toolchain

property toolchain_version

Return currently targeted version of MSVC toolchain Override this method to select a specific version of the toolchain or change selection heuristics. Default is whatever version of msvc has been selected by concretization

class spack.build_systems.msbuild.MSBuildPackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using Visual Studio project files or solutions.

build_system_class = 'MSBuildPackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.nmake module

class spack.build_systems.nmake.NMakeBuilder(pkg)[source]

Bases: BaseBuilder

The NMake builder encodes the most common way of building software with Mircosoft’s NMake tool. It has two phases that can be overridden, if need be:

It is usually necessary to override the install() phase as many packages with NMake systems neglect to provide an install target. The default install phase will attempt to invoke an install target from NMake. If none exists, this will result in a build failure

For a finer tuning you may override:

Method

Purpose

build_targets

Specify nmake targets for the build phase

install_targets

Specify nmake targets for the install phase

build_directory()

Directory where the project makefile is located

build(pkg, spec, prefix)[source]

Run “nmake” on the build targets specified by the builder.

property build_directory

Return the directory containing the makefile.

build_system: str | None = 'nmake'

Build system name. Must also be defined in derived classes.

build_targets: List[str] = []

Targets for make during the build() phase

define(nmake_arg, value)[source]

Helper method to format arguments to nmake command line

property ignore_quotes

Control whether or not Spack warns about quoted arguments passed to build utilities. If this is True, spack will not warn about quotes. This is useful in cases with a space in the path or when build scripts require quoted arugments.

install(pkg, spec, prefix)[source]

Run “nmake” on the install targets specified by the builder. This is INSTALL by default

install_targets: List[str] = ['INSTALL']

Targets for make during the install() phase

property makefile_name

Name of the current makefile. This is currently an empty value. If a project defines this value, it will be used with the /f argument to provide nmake an explicit makefile. This is usefule in scenarios where there are multiple nmake files in the same directory.

property makefile_root

The relative path to the directory containing nmake makefile

This path is relative to the root of the extracted tarball, not to the build_directory. Defaults to the current directory.

nmake_args()[source]

Define build arguments to NMake. This is an empty list by default. Individual packages should override to specify NMake args to command line

nmake_install_args()[source]

Define arguments appropriate only for install phase to NMake. This is an empty list by default. Individual packages should override to specify NMake args to command line

override_env(var_name, new_value)[source]

Helper method to format arguments for overridding env variables on the nmake command line. Returns properly formatted argument

phases: Tuple[str, ...] = ('build', 'install')

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
property std_nmake_args

Returns list of standards arguments provided to NMake Currently is only /NOLOGO

class spack.build_systems.nmake.NMakePackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using a Makefiles.

build_system_class = 'NMakePackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.octave module

class spack.build_systems.octave.OctaveBuilder(pkg)[source]

Bases: BaseBuilder

The octave builder provides the following phases that can be overridden:

  1. install()

build_system: str | None = 'octave'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str]
install(pkg, spec, prefix)[source]

Install the package from the archive file

install_time_test_callbacks: List[str]
legacy_attributes: Tuple[str, ...] = ()

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ()

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('install',)

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
setup_build_environment(env)[source]

Sets up the build environment for a package.

This method will be called before the current package prefix exists in Spack’s store.

Parameters:

env (spack.util.environment.EnvironmentModifications) – environment modifications to be applied when the package is built. Package authors can call methods on it to alter the build environment.

class spack.build_systems.octave.OctavePackage(spec)[source]

Bases: PackageBase

Specialized class for Octave packages. See https://www.gnu.org/software/octave/doc/v4.2.0/Installing-and-Removing-Packages.html for more information.

build_system_class = 'OctavePackage'
conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'octave'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.oneapi module

Common utilities for managing intel oneapi packages.

spack.build_systems.oneapi.INTEL_MATH_LIBRARIES = ('intel-mkl', 'intel-oneapi-mkl', 'intel-parallel-studio')

Tuple of Intel math libraries, exported to packages

class spack.build_systems.oneapi.IntelOneApiLibraryPackage(spec)[source]

Bases: IntelOneApiPackage

Base class for Intel oneAPI library packages.

Contains some convenient default implementations for libraries. Implement the method directly in the package if something different is needed.

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
header_directories(dirs)[source]
property headers
languages: Dict[spack.spec.Spec, Set[str]]
property libs
openmp_libs()[source]

Supply LibraryList for linking OpenMP

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict
class spack.build_systems.oneapi.IntelOneApiLibraryPackageWithSdk(spec)[source]

Bases: IntelOneApiPackage

Base class for Intel oneAPI library packages with SDK components.

Contains some convenient default implementations for libraries that expose functionality in sdk subdirectories. Implement the method directly in the package if something different is needed.

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
property headers
languages: Dict[spack.spec.Spec, Set[str]]
property libs
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict
class spack.build_systems.oneapi.IntelOneApiPackage(spec)[source]

Bases: Package

Base class for Intel oneAPI packages.

c = 'platform=windows:'
property component_dir

Subdirectory for this component in the install prefix.

property component_prefix

Path to component <prefix>/<component>/<version>.

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
property env_script_args

Additional arguments to pass to vars.sh script.

homepage: str | None = 'https://software.intel.com/oneapi'

Package homepage where users can find more information about the package

install(spec, prefix)[source]
install_component(installer_path)[source]

Shared install method for all oneapi packages.

languages: Dict[spack.spec.Spec, Set[str]]
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
redistribute_source = False
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
setup_run_environment(env)[source]

Adds environment variables to the generated module file.

These environment variables come from running:

$ source {prefix}/{component}/{version}/env/vars.sh
spec: spack.spec.Spec
static update_description(cls)[source]

Updates oneapi package descriptions with common text.

property v2_layout

Returns true if this version implements the v2 directory layout.

property v2_layout_versions

Version that implements the v2 directory layout.

variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict
class spack.build_systems.oneapi.IntelOneApiStaticLibraryList(static_libs, dynamic_libs)[source]

Bases: object

Provides ld_flags when static linking is needed

Oneapi puts static and dynamic libraries in the same directory, so -l will default to finding the dynamic library. Use absolute paths, as recommended by oneapi documentation.

Allow both static and dynamic libraries to be supplied by the package.

property directories
property ld_flags
property search_flags

spack.build_systems.perl module

class spack.build_systems.perl.PerlBuilder(pkg)[source]

Bases: BaseBuilder

The perl builder provides four phases that can be overridden, if required:

The default methods use, in order of preference:
  1. Makefile.PL,

  2. Build.PL.

Some packages may need to override configure_args(), which produces a list of arguments for configure().

Arguments should not include the installation base directory.

build(pkg, spec, prefix)[source]

Builds a Perl package.

property build_executable

Returns the executable method to build the perl package

property build_method

Searches the package for either a Makefile.PL or Build.PL.

Raises:

RuntimeError – if neither Makefile.PL nor Build.PL exist

build_system: str | None = 'perl'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str] = ['check']

Callback names for build-time test

check()[source]

Runs built-in tests of a Perl package.

configure(pkg, spec, prefix)[source]

Run Makefile.PL or Build.PL with arguments consisting of an appropriate installation base directory followed by the list returned by configure_args().

configure_args()[source]

List of arguments passed to configure().

Arguments should not include the installation base directory, which is prepended automatically.

fix_shebang()[source]
install(pkg, spec, prefix)[source]

Installs a Perl package.

install_time_test_callbacks: List[str]
legacy_attributes: Tuple[str, ...] = ()

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('configure_args', 'check', 'test_use')

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('configure', 'build', 'install')

Phases of a Perl package

run_after_callbacks = [(('configure', None), <function PerlBuilder.fix_shebang>), (('build', None), <function execute_build_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.perl.PerlPackage(spec)[source]

Bases: PackageBase

Specialized class for packages that are built using Perl.

build_system_class = 'PerlPackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'perl'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
property skip_modules: Iterable[str]

Names of modules that should be skipped when running tests.

These are a subset of use_modules.

Returns:

List of strings of module names.

spec: spack.spec.Spec
test_use()[source]

Test ‘use module’

property use_modules: Iterable[str]

Names of the package’s perl modules.

variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.python module

class spack.build_systems.python.PythonExtension(spec)[source]

Bases: PackageBase

add_files_to_view(view, merge_map, skip_if_exists=True)[source]

Given a map of package files to destination paths in the view, add the files to the view. By default this adds all files. Alternative implementations may skip some files, for example if other packages linked into the view already include the file.

Parameters:
  • view (spack.filesystem_view.FilesystemView) – the view that’s updated

  • merge_map (dict) – maps absolute source paths to absolute dest paths for all files in from this package.

  • skip_if_exists (bool) – when True, don’t link files in view when they already exist. When False, always link files, without checking if they already exist.

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
get_external_python_for_prefix()[source]

For an external package that extends python, find the most likely spec for the python it depends on.

First search: an “installed” external that shares a prefix with this package Second search: a configured external that shares a prefix with this package Third search: search this prefix for a python package

Returns:

The external Spec for python most likely to be compatible with self.spec

Return type:

spack.spec.Spec

property import_modules: Iterable[str]

Names of modules that the Python package provides.

These are used to test whether or not the installation succeeded. These names generally come from running:

>> import setuptools
>> setuptools.find_packages()

in the source tarball directory. If the module names are incorrectly detected, this property can be overridden by the package.

Returns:

List of strings of module names.

languages: Dict[spack.spec.Spec, Set[str]]
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
remove_files_from_view(view, merge_map)[source]

Given a map of package files to files currently linked in the view, remove the files from the view. The default implementation removes all files. Alternative implementations may not remove all files. For example if two packages include the same file, it should only be removed when both packages are removed.

requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
property skip_modules: Iterable[str]

Names of modules that should be skipped when running tests.

These are a subset of import_modules. If a module has submodules, they are skipped as well (meaning a.b is skipped if a is contained).

Returns:

List of strings of module names.

spec: spack.spec.Spec
test_imports() None[source]

Attempts to import modules of the installed package.

update_external_dependencies(extendee_spec=None)[source]

Ensure all external python packages have a python dependency

If another package in the DAG depends on python, we use that python for the dependency of the external. If not, we assume that the external PythonPackage is installed into the same directory as the python it depends on.

variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict
view_file_conflicts(view, merge_map)[source]

Report all file conflicts, excepting special cases for python. Specifically, this does not report errors for duplicate __init__.py files for packages in the same namespace.

class spack.build_systems.python.PythonPackage(spec)[source]

Bases: PythonExtension

Specialized class for packages that are built using pip.

build_system_class = 'PythonPackage'
property headers: HeaderList

Discover header files in platlib.

homepage: str | None = None

Package homepage where users can find more information about the package

install_time_test_callbacks = ['test']

Callback names for install-time test

legacy_buildsystem = 'python_pip'

Legacy buildsystem attribute used to deserialize and install old specs

property libs: LibraryList

Discover libraries in platlib.

list_url: str | None = None

Default list URL (place to find available versions)

py_namespace: str | None = None
pypi: str | None = None

Package name, version, and extension on PyPI

run_after_callbacks = []
run_before_callbacks = []
url = None
class spack.build_systems.python.PythonPipBuilder(pkg)[source]

Bases: BaseBuilder

property build_directory: str

The root directory of the Python package.

This is usually the directory containing one of the following files:

  • pyproject.toml

  • setup.cfg

  • setup.py

build_system: str | None = 'python_pip'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str]
config_settings(spec: Spec, prefix: Prefix) Mapping[str, object][source]

Configuration settings to be passed to the PEP 517 build backend.

Requires pip 22.1 or newer for keys that appear only a single time, or pip 23.1 or newer if the same key appears multiple times.

Parameters:
  • spec – Build spec.

  • prefix – Installation prefix.

Returns:

Possibly nested dictionary of KEY, VALUE settings.

global_options(spec: Spec, prefix: Prefix) Iterable[str][source]

Extra global options to be supplied to the setup.py call before the install or bdist_wheel command.

Deprecated in pip 23.1.

Parameters:
  • spec – Build spec.

  • prefix – Installation prefix.

Returns:

List of options.

install(pkg: PythonPackage, spec: Spec, prefix: Prefix) None[source]

Install everything from build directory.

install_options(spec: Spec, prefix: Prefix) Iterable[str][source]

Extra arguments to be supplied to the setup.py install command.

Requires pip 23.0 or older.

Parameters:
  • spec – Build spec.

  • prefix – Installation prefix.

Returns:

List of options.

install_time_test_callbacks: List[str] = ['test']

Callback names for install-time test

legacy_attributes: Tuple[str, ...] = ('archive_files', 'build_directory', 'install_time_test_callbacks')

Names associated with package attributes in the old build-system format

legacy_long_methods = ('install_options', 'global_options', 'config_settings')

Same as legacy_methods, but the signature is different

legacy_methods: Tuple[str, ...] = ('test',)

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('install',)

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('install', None), <function execute_install_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
static std_args(cls) List[str][source]

spack.build_systems.qmake module

class spack.build_systems.qmake.QMakeBuilder(pkg)[source]

Bases: BaseBuilder

The qmake builder provides three phases that can be overridden:

  1. qmake()

  2. build()

  3. install()

They all have sensible defaults and for many packages the only thing necessary will be to override qmake_args().

build(pkg, spec, prefix)[source]

Make the build targets

property build_directory

The directory containing the *.pro file.

build_system: str | None = 'qmake'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str] = ['check']

Callback names for build-time test

check()[source]

Search the Makefile for a check: target and runs it if found.

install(pkg, spec, prefix)[source]

Make the install targets

install_time_test_callbacks: List[str]
legacy_attributes: Tuple[str, ...] = ('build_directory', 'build_time_test_callbacks')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('qmake_args', 'check')

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('qmake', 'build', 'install')

Sequence of phases. Must be defined in derived classes

qmake(pkg, spec, prefix)[source]

Run qmake to configure the project and generate a Makefile.

qmake_args()[source]

List of arguments passed to qmake.

run_after_callbacks = [(('build', None), <function execute_build_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.qmake.QMakePackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using qmake.

For more information on the qmake build system, see: http://doc.qt.io/qt-5/qmake-manual.html

build_system_class = 'QMakePackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'qmake'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.r module

class spack.build_systems.r.RBuilder(pkg)[source]

Bases: GenericBuilder

The R builder provides a single phase that can be overridden:

It has sensible defaults, and for many packages the only thing necessary will be to add dependencies.

configure_args()[source]

Arguments to pass to install via --configure-args.

configure_vars()[source]

Arguments to pass to install via --configure-vars.

install(pkg, spec, prefix)[source]

Installs an R package.

legacy_methods: Tuple[str, ...] = ('configure_args', 'configure_vars')

Names associated with package methods in the old build-system format

run_after_callbacks = [(('install', 'platform=darwin'), <function apply_macos_rpath_fixups>), (('install', None), <function execute_install_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.r.RPackage(spec)[source]

Bases: Package

Specialized class for packages that are built using R.

For more information on the R build system, see: https://stat.ethz.ch/R-manual/R-devel/library/utils/html/INSTALL.html

GenericBuilder

alias of RBuilder

bioc: str | None = None
build_system_class = 'RPackage'

This attribute is used in UI queries that need to know the build system base class

cran: str | None = None
property git
homepage: str | None = None

Package homepage where users can find more information about the package

list_url: str | None = None

Default list URL (place to find available versions)

run_after_callbacks = []
run_before_callbacks = []
url = None

spack.build_systems.racket module

class spack.build_systems.racket.RacketBuilder(pkg)[source]

Bases: Builder

The Racket builder provides an install phase that can be overridden.

property build_directory
build_system: str | None = 'racket'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str] = ['check']

Callback names for build-time test

install(pkg, spec, prefix)[source]

Install everything from build directory.

legacy_attributes: Tuple[str, ...] = ('build_directory', 'build_time_test_callbacks', 'subdirectory')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ()

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('install',)

Sequence of phases. Must be defined in derived classes

racket_name: str | None = None
run_after_callbacks = []
run_before_callbacks = []
property subdirectory
class spack.build_systems.racket.RacketPackage(spec)[source]

Bases: PackageBase

Specialized class for packages that are built using Racket’s raco pkg install and raco setup commands.

build_system_class = 'RacketPackage'
homepage: str | None = None

Package homepage where users can find more information about the package

legacy_buildsystem = 'racket'

Legacy buildsystem attribute used to deserialize and install old specs

parallel = True

By default we build in parallel. Subclasses can override this.

racket_name: str | None = None
run_after_callbacks = []
run_before_callbacks = []

spack.build_systems.rocm module

class spack.build_systems.rocm.ROCmPackage(spec)[source]

Bases: PackageBase

Auxiliary class which contains ROCm variant, dependencies and conflicts and is meant to unify and facilitate its usage. Closely mimics CudaPackage.

Maintainers: dtaller

amdgpu_targets = ('gfx701', 'gfx801', 'gfx802', 'gfx803', 'gfx900', 'gfx900:xnack-', 'gfx902', 'gfx904', 'gfx906', 'gfx906:xnack-', 'gfx908', 'gfx908:xnack-', 'gfx909', 'gfx90a', 'gfx90a:xnack-', 'gfx90a:xnack+', 'gfx90c', 'gfx940', 'gfx941', 'gfx942', 'gfx1010', 'gfx1011', 'gfx1012', 'gfx1013', 'gfx1030', 'gfx1031', 'gfx1032', 'gfx1033', 'gfx1034', 'gfx1035', 'gfx1036', 'gfx1100', 'gfx1101', 'gfx1102', 'gfx1103')
static asan_on(env, llvm_path)[source]
conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
static hip_flags(amdgpu_target)[source]
languages: Dict[spack.spec.Spec, Set[str]]
patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.ruby module

class spack.build_systems.ruby.RubyBuilder(pkg)[source]

Bases: BaseBuilder

The Ruby builder provides two phases that can be overridden if required:

  1. build()

  2. install()

build(pkg, spec, prefix)[source]

Build a Ruby gem.

build_system: str | None = 'ruby'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str]
install(pkg, spec, prefix)[source]

Install a Ruby gem.

The ruby package sets GEM_HOME to tell gem where to install to.

install_time_test_callbacks: List[str]
legacy_attributes: Tuple[str, ...] = ()

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ()

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('build', 'install')

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.ruby.RubyPackage(spec)[source]

Bases: PackageBase

Specialized class for building Ruby gems.

build_system_class = 'RubyPackage'

This attribute is used in UI queries that need to know the build system base class

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'ruby'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.scons module

class spack.build_systems.scons.SConsBuilder(pkg)[source]

Bases: BaseBuilder

The Scons builder provides the following phases that can be overridden:

  1. build()

  2. install()

Packages that use SCons as a build system are less uniform than packages that use other build systems. Developers can add custom subcommands or variables that control the build. You will likely need to override build_args() to pass the appropriate variables.

build(pkg, spec, prefix)[source]

Build the package.

build_args(spec, prefix)[source]

Arguments to pass to build.

build_system: str | None = 'scons'

Build system name. Must also be defined in derived classes.

build_test()[source]

Run unit tests after build.

By default, does nothing. Override this if you want to add package-specific tests.

build_time_test_callbacks: List[str] = ['build_test']

Callback names for build-time test

install(pkg, spec, prefix)[source]

Install the package.

install_args(spec, prefix)[source]

Arguments to pass to install.

install_time_test_callbacks: List[str]
legacy_attributes: Tuple[str, ...] = ('build_time_test_callbacks',)

Names associated with package attributes in the old build-system format

legacy_long_methods = ('build_args', 'install_args')

Same as legacy_methods, but the signature is different

legacy_methods: Tuple[str, ...] = ('build_test',)

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('build', 'install')

Phases of a SCons package

run_after_callbacks = [(('build', None), <function execute_build_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.scons.SConsPackage(spec)[source]

Bases: PackageBase

Specialized class for packages built using SCons.

See http://scons.org/documentation.html for more information.

build_system_class = 'SConsPackage'

To be used in UI queries that require to know which build-system class we are using

conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'scons'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.sip module

class spack.build_systems.sip.SIPBuilder(pkg)[source]

Bases: BaseBuilder

The SIP builder provides the following phases that can be overridden:

  • configure

  • build

  • install

The configure phase already adds a set of default flags. To see more options, run sip-build --help.

build(pkg, spec, prefix)[source]

Build the package.

build_args()[source]

Arguments to pass to build.

build_directory = 'build'
build_system: str | None = 'sip'

Build system name. Must also be defined in derived classes.

build_time_test_callbacks: List[str]
configure(pkg, spec, prefix)[source]

Configure the package.

configure_args()[source]

Arguments to pass to configure.

install(pkg, spec, prefix)[source]

Install the package.

install_args()[source]

Arguments to pass to install.

install_time_test_callbacks: List[str]
legacy_attributes: Tuple[str, ...] = ('build_targets', 'install_targets', 'build_time_test_callbacks', 'install_time_test_callbacks', 'build_directory')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('configure_args', 'build_args', 'install_args')

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('configure', 'build', 'install')

Sequence of phases. Must be defined in derived classes

run_after_callbacks = [(('install', None), <function execute_install_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
class spack.build_systems.sip.SIPPackage(spec)[source]

Bases: PackageBase

Specialized class for packages that are built using the SIP build system. See https://www.riverbankcomputing.com/software/sip/intro for more information.

build_system_class = 'SIPPackage'
conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
property import_modules

Names of modules that the Python package provides.

These are used to test whether or not the installation succeeded. These names generally come from running:

>> import setuptools
>> setuptools.find_packages()

in the source tarball directory. If the module names are incorrectly detected, this property can be overridden by the package.

Returns:

list of strings of module names

Return type:

list

install_time_test_callbacks = ['test_imports']

Callback names for install-time testing

languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'sip'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
python(*args, **kwargs)[source]

The python Executable.

requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
sip_module = 'sip'

Name of private sip module to install alongside package

spec: spack.spec.Spec
test_imports()[source]

Attempts to import modules of the installed package.

variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.sourceforge module

class spack.build_systems.sourceforge.SourceforgePackage(spec)[source]

Bases: PackageBase

Mixin that takes care of setting url and mirrors for Sourceforge packages.

base_mirrors = ['https://prdownloads.sourceforge.net/', 'https://freefr.dl.sourceforge.net/', 'https://netcologne.dl.sourceforge.net/', 'https://pilotfiber.dl.sourceforge.net/', 'https://downloads.sourceforge.net/', 'http://kent.dl.sourceforge.net/sourceforge/']

List of Sourceforge mirrors used by Spack

run_after_callbacks = []
run_before_callbacks = []
sourceforge_mirror_path: str | None = None

Path of the package in a Sourceforge mirror

property urls

spack.build_systems.sourceware module

class spack.build_systems.sourceware.SourcewarePackage(spec)[source]

Bases: PackageBase

Mixin that takes care of setting url and mirrors for Sourceware.org packages.

base_mirrors = ['https://sourceware.org/pub/', 'https://mirrors.kernel.org/sourceware/', 'https://ftp.gwdg.de/pub/linux/sources.redhat.com/']

List of Sourceware mirrors used by Spack

run_after_callbacks = []
run_before_callbacks = []
sourceware_mirror_path: str | None = None

Path of the package in a Sourceware mirror

property urls

spack.build_systems.waf module

class spack.build_systems.waf.WafBuilder(pkg)[source]

Bases: BaseBuilder

The WAF builder provides the following phases that can be overridden:

  • configure

  • build

  • install

These are all standard Waf commands and can be found by running:

$ python waf --help

Each phase provides a function <phase> that runs:

$ python waf -j<jobs> <phase>

where <jobs> is the number of parallel jobs to build with. Each phase also has a <phase_args> function that can pass arguments to this call. All of these functions are empty except for the configure_args function, which passes --prefix=/path/to/installation/prefix.

build(pkg, spec, prefix)[source]

Executes the build.

build_args()[source]

Arguments to pass to build.

property build_directory

The directory containing the waf file.

build_system: str | None = 'waf'

Build system name. Must also be defined in derived classes.

build_test()[source]

Run unit tests after build.

By default, does nothing. Override this if you want to add package-specific tests.

build_time_test_callbacks: List[str] = ['build_test']
configure(pkg, spec, prefix)[source]

Configures the project.

configure_args()[source]

Arguments to pass to configure.

install(pkg, spec, prefix)[source]

Installs the targets on the system.

install_args()[source]

Arguments to pass to install.

install_test()[source]

Run unit tests after install.

By default, does nothing. Override this if you want to add package-specific tests.

install_time_test_callbacks: List[str] = ['install_test']
legacy_attributes: Tuple[str, ...] = ('build_time_test_callbacks', 'build_directory', 'install_time_test_callbacks')

Names associated with package attributes in the old build-system format

legacy_methods: Tuple[str, ...] = ('build_test', 'install_test', 'configure_args', 'build_args', 'install_args', 'build_test', 'install_test')

Names associated with package methods in the old build-system format

phases: Tuple[str, ...] = ('configure', 'build', 'install')

Sequence of phases. Must be defined in derived classes

python(*args, **kwargs)[source]

The python Executable.

run_after_callbacks = [(('build', None), <function execute_build_time_tests>), (('install', None), <function execute_install_time_tests>), (('install', None), <function sanity_check_prefix>)]
run_before_callbacks = []
waf(*args, **kwargs)[source]

Runs the waf Executable.

class spack.build_systems.waf.WafPackage(spec)[source]

Bases: PackageBase

Specialized class for packages that are built using the Waf build system. See https://waf.io/book/ for more information.

build_system_class = 'WafPackage'
conflicts: Dict[spack.spec.Spec, List[Tuple[spack.spec.Spec, str | None]]]
dependencies: Dict[spack.spec.Spec, Dict[str, spack.dependency.Dependency]]
languages: Dict[spack.spec.Spec, Set[str]]
legacy_buildsystem = 'waf'

Legacy buildsystem attribute used to deserialize and install old specs

patches: Dict[spack.spec.Spec, List[spack.patch.Patch]]
provided: Dict[spack.spec.Spec, Set[spack.spec.Spec]]
provided_together: Dict[spack.spec.Spec, List[Set[str]]]
requirements: Dict[spack.spec.Spec, List[Tuple[Tuple[spack.spec.Spec, ...], str, str | None]]]
run_after_callbacks = []
run_before_callbacks = []
spec: spack.spec.Spec
variants: Dict[str, Tuple[spack.variant.Variant, spack.spec.Spec]]
versions: dict

spack.build_systems.xorg module

class spack.build_systems.xorg.XorgPackage(spec)[source]

Bases: PackageBase

Mixin that takes care of setting url and mirrors for x.org packages.

base_mirrors = ['https://www.x.org/archive/individual/', 'https://mirrors.ircam.fr/pub/x.org/individual/', 'https://mirror.transip.net/xorg/individual/', 'ftp://ftp.freedesktop.org/pub/xorg/individual/', 'http://xorg.mirrors.pair.com/individual/']
run_after_callbacks = []
run_before_callbacks = []
property urls
xorg_mirror_path: str | None = None

Path of the package in a x.org mirror