spack.build_systems package¶
Submodules¶
spack.build_systems.aspell_dict module¶
-
class
spack.build_systems.aspell_dict.
AspellDictPackage
(spec)¶ Bases:
spack.build_systems.autotools.AutotoolsPackage
Specialized class for builing aspell dictionairies.
-
configure
(spec, prefix)¶ Runs configure with the arguments specified in
configure_args()
and an appropriately set prefix.
-
patch
()¶
-
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 phaseinstall_targets
Specify make
targets for the install phasecheck()
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_time_test_callbacks
= ['check']¶ Callback names for build-time test
-
check
()¶ Searches the Makefile for targets
test
andcheck
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
()¶
-
enable_or_disable
(name, activation_value=None)¶ Same as
with_or_without()
but substitutewith
withenable
andwithout
withdisable
.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
-
flags_to_build_system_args
(flags)¶ Produces a list of all command line arguments to pass specified compiler flags to configure.
-
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_time_test_callbacks
= ['installcheck']¶ Callback names for install-time test
-
installcheck
()¶ Searches the Makefile for an
installcheck
target and runs it if found.
-
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()
-
with_or_without
(name, activation_value=None)¶ 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 notvariant=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
-
spack.build_systems.cmake module¶
-
class
spack.build_systems.cmake.
CMakePackage
(spec)¶ Bases:
spack.package.PackageBase
Specialized class for packages built using CMake
For more information on the CMake build system, see: https://cmake.org/cmake/help/latest/
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 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']¶
-
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
-
flags_to_build_system_args
(flags)¶ Produces 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.
-
generator
= 'Unix Makefiles'¶ 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.
-
install
(spec, prefix)¶ Make the install targets
-
install_targets
= ['install']¶
-
phases
= ['cmake', 'build', 'install']¶ Phases of a CMake package
-
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.Returns: directory containing CMakeLists.txt
-
std_cmake_args
¶ Standard cmake arguments provided as a property for convenience of package writers
Returns: standard cmake arguments
-
spack.build_systems.cuda module¶
-
class
spack.build_systems.cuda.
CudaPackage
(spec)¶ Bases:
spack.package.PackageBase
Auxiliary class which contains CUDA variant, dependencies and conflicts and is meant to unify and facilitate its usage.
-
static
cuda_flags
()¶
-
static
spack.build_systems.intel module¶
-
class
spack.build_systems.intel.
IntelPackage
(spec)¶ Bases:
spack.package.PackageBase
Specialized class for licensed Intel software.
This class provides two phases that can be overridden:
They both have sensible defaults and for many packages the only thing necessary will be to override
setup_environment
to set the appropriate environment variables.-
build_system_class
= 'IntelPackage'¶ This attribute is used in UI queries that need to know the build system base class
-
components
= ['ALL']¶ Components of the package to install. By default, install ‘ALL’ components.
-
configure
(spec, prefix)¶ Writes the
silent.cfg
file used to configure the installation.See https://software.intel.com/en-us/articles/configuration-file-format
-
global_license_file
¶ Returns the path where a global license file should be stored.
All Intel software shares the same license, so we store it in a common ‘intel’ directory.
-
install
(spec, prefix)¶ Runs the
install.sh
installation script.
-
license_comment
= '#'¶ Comment symbol used in the
license.lic
file
-
license_files
= ['Licenses/license.lic']¶ Location where Intel searches for a license file
-
license_required
= True¶ By default, we assume that all Intel software requires a license. This can be overridden for packages that do not require a license.
-
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
= ['INTEL_LICENSE_FILE']¶ Environment variables that Intel searches for a license file
-
phases
= ['configure', 'install']¶ Phases of an Intel package
-
save_silent_cfg
()¶ Copies the silent.cfg configuration file to
<prefix>/.spack
.
-
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, whilebuild()
andinstall()
have sensible defaults. For a finer tuning you may override:Method Purpose build_targets
Specify make
targets for the build phaseinstall_targets
Specify make
targets for the install phasebuild_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_time_test_callbacks
= ['check']¶ Callback names for build-time test
-
check
()¶ Searches the Makefile for targets
test
andcheck
and runs them if found.
-
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_time_test_callbacks
= ['installcheck']¶ Callback names for install-time test
-
installcheck
()¶ Searches the Makefile for an
installcheck
target and runs it if found.
-
phases
= ['edit', 'build', 'install']¶ Phases of a package that is built with an hand-written Makefile
-
spack.build_systems.octave module¶
-
class
spack.build_systems.octave.
OctavePackage
(spec)¶ Bases:
spack.package.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.
This class provides the following phases that can be overridden:
-
build_system_class
= 'OctavePackage'¶
-
install
(spec, prefix)¶ Install the package from the archive file
-
phases
= ['install']¶
-
setup_environment
(spack_env, run_env)¶ Set up the compile and runtime environments for a package.
-
spack.build_systems.perl module¶
-
class
spack.build_systems.perl.
PerlPackage
(spec)¶ Bases:
spack.package.PackageBase
Specialized class for packages that are built using Perl.
This class provides four phases that can be overridden if required:
- The default methods use, in order of preference:
- Makefile.PL,
- Build.PL.
Some packages may need to override
configure_args()
, which produces a list of arguments forconfigure()
. Arguments should not include the installation base directory.-
build
(spec, prefix)¶ Builds a Perl package.
-
build_system_class
= 'PerlPackage'¶ This attribute is used in UI queries that need to know the build system base class
-
build_time_test_callbacks
= ['check']¶ Callback names for build-time test
-
check
()¶ Runs built-in tests of a Perl package.
-
configure
(spec, prefix)¶ Runs Makefile.PL or Build.PL with arguments consisting of an appropriate installation base directory followed by the list returned by
configure_args()
.Raises: RuntimeError – if neither Makefile.PL or Build.PL exist
-
configure_args
()¶ Produces a list containing the arguments that must be passed to
configure()
. Arguments should not include the installation base directory, which is prepended automatically.Returns: list of arguments for Makefile.PL or Build.PL
-
install
(spec, prefix)¶ Installs a Perl package.
-
phases
= ['configure', 'build', 'install']¶ Phases of a Perl package
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 -s setup.py --no-user-cfg <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'¶
-
build_time_test_callbacks
= ['test']¶ Callback names for build-time test
-
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.
-
import_module_test
()¶ Attempts to import the module that was just installed.
This test is only run if the package overrides
import_modules
with a list of module names.
-
import_modules
= []¶
-
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.
-
install_time_test_callbacks
= ['import_module_test']¶ Callback names for install-time test
-
phases
= ['build', 'install']¶
-
python
(*args, **kwargs)¶
-
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, **kwargs)¶
-
test
()¶ Run unit tests after in-place build.
These tests are only run if the package actually has a ‘test’ command.
-
test_args
(spec, prefix)¶ Arguments to pass to test.
-
upload
(spec, prefix)¶ Upload binary package to PyPI.
-
upload_args
(spec, prefix)¶ Arguments to pass to upload.
spack.build_systems.qmake module¶
-
class
spack.build_systems.qmake.
QMakePackage
(spec)¶ Bases:
spack.package.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
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
qmake_args()
.-
build
(spec, prefix)¶ Make the build targets
-
build_system_class
= 'QMakePackage'¶ This attribute is used in UI queries that need to know the build system base class
-
build_time_test_callbacks
= ['check']¶ Callback names for build-time test
-
check
()¶ Searches the Makefile for a
check:
target and runs it if found.
-
install
(spec, prefix)¶ Make the install targets
-
phases
= ['qmake', 'build', 'install']¶ Phases of a qmake package
-
qmake
(spec, prefix)¶ Run
qmake
to configure the project and generate a Makefile.
-
qmake_args
()¶ Produces a list containing all the arguments that must be passed to qmake
-
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.
For more information on the R build system, see: https://stat.ethz.ch/R-manual/R-devel/library/utils/html/INSTALL.html
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
-
configure_args
()¶ Arguments to pass to install via
--configure-args
.
-
configure_vars
()¶ Arguments to pass to install via
--configure-vars
.
-
install
(spec, prefix)¶ Installs an R package.
-
phases
= ['install']¶
-
spack.build_systems.scons module¶
-
class
spack.build_systems.scons.
SConsPackage
(spec)¶ Bases:
spack.package.PackageBase
Specialized class for packages built using SCons.
See http://scons.org/documentation.html for more information.
This class provides the following phases that can be overridden:
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
(spec, prefix)¶ Build the package.
-
build_args
(spec, prefix)¶ Arguments to pass to build.
-
build_system_class
= 'SConsPackage'¶ To be used in UI queries that require to know which build-system class we are using
-
build_time_test_callbacks
= ['test']¶ Callback names for build-time test
-
install
(spec, prefix)¶ Install the package.
-
install_args
(spec, prefix)¶ Arguments to pass to install.
-
phases
= ['build', 'install']¶ Phases of a SCons package
-
test
()¶ Run unit tests after build.
By default, does nothing. Override this if you want to add package-specific tests.
-
spack.build_systems.waf module¶
-
class
spack.build_systems.waf.
WafPackage
(spec)¶ Bases:
spack.package.PackageBase
Specialized class for packages that are built using the Waf build system. See https://waf.io/book/ for more information.
This class 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
(spec, prefix)¶ Executes the build.
-
build_args
()¶ Arguments to pass to build.
-
build_directory
¶ The directory containing the
waf
file.
-
build_system_class
= 'WafPackage'¶
-
build_time_test_callbacks
= ['test']¶
-
configure
(spec, prefix)¶ Configures the project.
-
configure_args
()¶ Arguments to pass to configure.
-
install
(spec, prefix)¶ Installs the targets on the system.
-
install_args
()¶ Arguments to pass to install.
-
install_time_test_callbacks
= ['installtest']¶
-
installtest
()¶ Run unit tests after install.
By default, does nothing. Override this if you want to add package-specific tests.
-
phases
= ['configure', 'build', 'install']¶
-
python
(*args, **kwargs)¶ The python
Executable
.
-
test
()¶ Run unit tests after build.
By default, does nothing. Override this if you want to add package-specific tests.
-
waf
(*args, **kwargs)¶ Runs the waf
Executable
.