spack.build_systems package

Submodules

spack.build_systems.autotools module

class spack.build_systems.autotools.AutotoolsPackage(spec)

Bases: spack.package.PackageBase

Specialized class for packages built using GNU Autotools.

This class provides four phases that can be overridden:

They all have sensible defaults and for many packages the only thing necessary will be 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
autoreconf(spec, prefix)

Not needed usually, configure should be already there

autoreconf_extra_args = []

Options to be passed to autoreconf when using the default implementation

build(spec, prefix)

Makes the build targets specified by :py:attr:~.AutotoolsPackage.build_targets

build_directory

Override to provide another place to build the package

build_system_class = 'AutotoolsPackage'

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

build_targets = []

Targets for make during the build() phase

build_time_test_callbacks = ['check']

Callback names for build-time test

check()

Searches the Makefile for targets test and check and runs them if found.

configure(spec, prefix)

Runs configure with the arguments specified in configure_args() and an appropriately set prefix.

configure_abs_path
configure_args()

Produces a list containing all the arguments that must be passed to configure, except --prefix which will be pre-pended to the list.

Returns:list of arguments for configure
configure_directory

Returns the directory where ‘configure’ resides.

Returns:directory where to find configure
delete_configure_to_force_update()
force_autoreconf = False

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

install(spec, prefix)

Makes the install targets specified by :py:attr:~.AutotoolsPackage.install_targets

install_targets = ['install']

Targets for make during the install() phase

install_time_test_callbacks = ['installcheck']

Callback names for install-time test

installcheck()

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

patch()

Patches config.guess if :py:attr:~.AutotoolsPackage.patch_config_guess is True

Raises:RuntimeError – if something goes wrong when patching config.guess
patch_config_guess = True

Whether or not to update config.guess on old architectures

phases = ['autoreconf', 'configure', 'build', 'install']

Phases of a GNU Autotools package

set_configure_or_die()

Checks the presence of a configure file after the autoreconf phase. If it is found sets a module attribute appropriately, otherwise raises an error.

Raises:RuntimeError – if a configure script is not found in configure_directory()

spack.build_systems.cmake module

class spack.build_systems.cmake.CMakePackage(spec)

Bases: spack.package.PackageBase

Specialized class for packages built using CMake

This class provides 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
build_type() Specify the value for the CMAKE_BUILD_TYPE variable
root_cmakelists_dir() Location of the root CMakeLists.txt
build_directory() Directory where to build the package
build(spec, prefix)

Make the build targets

build_directory

Returns the directory to use when building the package

Returns:directory where to build the package
build_system_class = 'CMakePackage'

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

build_targets = []
build_time_test_callbacks = ['check']
build_type()

Returns the correct value for the CMAKE_BUILD_TYPE variable

Returns:value for CMAKE_BUILD_TYPE
check()

Searches the CMake-generated Makefile for the target test and runs it if found.

cmake(spec, prefix)

Runs cmake in the build directory

cmake_args()

Produces a list containing all the arguments that must be passed to cmake, except:

  • CMAKE_INSTALL_PREFIX
  • CMAKE_BUILD_TYPE

which will be set automatically.

Returns:list of arguments for cmake
install(spec, prefix)

Make the install targets

install_targets = ['install']
phases = ['cmake', 'build', 'install']

Phases of a CMake package

root_cmakelists_dir

Returns the location of the root CMakeLists.txt

Returns:directory containing the root CMakeLists.txt
std_cmake_args

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

Returns:standard cmake arguments

spack.build_systems.makefile module

class spack.build_systems.makefile.MakefilePackage(spec)

Bases: spack.package.PackageBase

Specialized class for packages that are built using editable Makefiles

This class provides three phases that can be overridden:

It is usually necessary to override the edit() phase, while build() and install() 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(spec, prefix)

Calls make, passing build_targets as targets.

build_directory

Returns the directory containing the main Makefile

Returns:build directory
build_system_class = 'MakefilePackage'

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

build_targets = []

Targets for make during the build() phase

edit(spec, prefix)

Edits the Makefile before calling make. This phase cannot be defaulted.

install(spec, prefix)

Calls make, passing install_targets as targets.

install_targets = ['install']

Targets for make during the install() phase

phases = ['edit', 'build', 'install']

Phases of a package that is built with an hand-written Makefile

spack.build_systems.python module

class spack.build_systems.python.PythonPackage(spec)

Bases: spack.package.PackageBase

Specialized class for packages that are built using Python setup.py files

This class provides the following phases that can be overridden:

  • build
  • build_py
  • build_ext
  • build_clib
  • build_scripts
  • clean
  • install
  • install_lib
  • install_headers
  • install_scripts
  • install_data
  • sdist
  • register
  • bdist
  • bdist_dumb
  • bdist_rpm
  • bdist_wininst
  • upload
  • check

These are all standard setup.py commands and can be found by running:

$ python setup.py --help-commands

By default, only the ‘build’ and ‘install’ phases are run, but if you need to run more phases, simply modify your phases list like so:

phases = ['build_ext', 'install', 'bdist']

Each phase provides a function <phase> that runs:

$ python --no-user-cfg setup.py <phase>

Each phase also has a <phase_args> function that can pass arguments to this call. All of these functions are empty except for the install_args function, which passes --prefix=/path/to/installation/directory.

If you need to run a phase which is not a standard setup.py command, you’ll need to define a function for it like so:

def configure(self, spec, prefix):
    self.setup_py('configure')
bdist(spec, prefix)

Create a built (binary) distribution.

bdist_args(spec, prefix)

Arguments to pass to bdist.

bdist_dumb(spec, prefix)

Create a “dumb” built distribution.

bdist_dumb_args(spec, prefix)

Arguments to pass to bdist_dumb.

bdist_rpm(spec, prefix)

Create an RPM distribution.

bdist_rpm_args(spec, prefix)

Arguments to pass to bdist_rpm.

bdist_wininst(spec, prefix)

Create an executable installer for MS Windows.

bdist_wininst_args(spec, prefix)

Arguments to pass to bdist_wininst.

build(spec, prefix)

Build everything needed to install.

build_args(spec, prefix)

Arguments to pass to build.

build_clib(spec, prefix)

Build C/C++ libraries used by Python extensions.

build_clib_args(spec, prefix)

Arguments to pass to build_clib.

build_directory

The directory containing the setup.py file.

build_ext(spec, prefix)

Build C/C++ extensions (compile/link to build directory).

build_ext_args(spec, prefix)

Arguments to pass to build_ext.

build_py(spec, prefix)

“Build” pure Python modules (copy to build directory).

build_py_args(spec, prefix)

Arguments to pass to build_py.

build_scripts(spec, prefix)

“Build” scripts (copy and fixup #! line).

build_system_class = 'PythonPackage'
check(spec, prefix)

Perform some checks on the package.

check_args(spec, prefix)

Arguments to pass to check.

clean(spec, prefix)

Clean up temporary files from ‘build’ command.

clean_args(spec, prefix)

Arguments to pass to clean.

install(spec, prefix)

Install everything from build directory.

install_args(spec, prefix)

Arguments to pass to install.

install_data(spec, prefix)

Install data files.

install_data_args(spec, prefix)

Arguments to pass to install_data.

install_headers(spec, prefix)

Install C/C++ header files.

install_headers_args(spec, prefix)

Arguments to pass to install_headers.

install_lib(spec, prefix)

Install all Python modules (extensions and pure Python).

install_lib_args(spec, prefix)

Arguments to pass to install_lib.

install_scripts(spec, prefix)

Install scripts (Python or otherwise).

install_scripts_args(spec, prefix)

Arguments to pass to install_scripts.

phases = ['build', 'install']
python(*args)
register(spec, prefix)

Register the distribution with the Python package index.

register_args(spec, prefix)

Arguments to pass to register.

sdist(spec, prefix)

Create a source distribution (tarball, zip file, etc.).

sdist_args(spec, prefix)

Arguments to pass to sdist.

setup_file()

Returns the name of the setup file to use.

setup_py(*args)
upload(spec, prefix)

Upload binary package to PyPI.

upload_args(spec, prefix)

Arguments to pass to upload.

spack.build_systems.r module

class spack.build_systems.r.RPackage(spec)

Bases: spack.package.PackageBase

Specialized class for packages that are built using R

This class 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

build_system_class = 'RPackage'

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

install(spec, prefix)

Installs an R package.

phases = ['install']

Module contents