easybuild.framework.easyblock module

Generic EasyBuild support for building and installing software. The EasyBlock class should serve as a base class for all easyblocks.

author:Stijn De Weirdt (Ghent University)
author:Dries Verdegem (Ghent University)
author:Kenneth Hoste (Ghent University)
author:Pieter De Baets (Ghent University)
author:Jens Timmerman (Ghent University)
author:Toon Willems (Ghent University)
author:Ward Poelmans (Ghent University)
author:Fotis Georgatos (Uni.Lu, NTUA)
author:Damian Alvarez (Forschungszentrum Juelich GmbH)
class easybuild.framework.easyblock.EasyBlock(ec)

Bases: object

Generic support for building and installing software, base class for actual easyblocks.

build_step()

Build software (abstract method).

check_readiness_step()

Verify if all is ok to start build.

checksum_step()

Verify checksum of sources and patches, if a checksum is available.

clean_up_fake_module(fake_mod_data)

Clean up fake module.

cleanup_step()

Cleanup leftover mess: remove/clean build directory

except when we’re building in the installation directory or cleanup_builddir is False, otherwise we remove the installation

close_log()

Shutdown the logger.

configure_step()

Configure build (abstract method).

det_iter_cnt()

Determine iteration count based on configure/build/install options that may be lists.

dry_run_msg(msg, *args)

Print dry run message.

extensions_step(fetch=False)

After make install, run this. - only if variable len(exts_list) > 0 - optionally: load module that was just created using temp module file - find source for extensions, in ‘extensions’ (and ‘packages’ for legacy reasons) - run extra_extensions

static extra_options(extra=None)

Extra options method which will be passed to the EasyConfig constructor.

extract_step()

Unpack the source files.

fetch_extension_sources(skip_checksums=False)

Find source file for extensions.

fetch_patches(patch_specs=None, extension=False, checksums=None)

Add a list of patches. All patches will be checked if a file exists (or can be located)

fetch_sources(sources=None, checksums=None)

Add a list of source files (can be tarballs, isos, urls). All source files will be checked if a file exists (or can be located)

Parameters:
  • sources – list of sources to fetch (if None, use ‘sources’ easyconfig parameter)
  • checksums – list of checksums for sources
fetch_step(skip_checksums=False)

Fetch source files and patches (incl. extensions).

full_mod_name

Full module name (including subdirectory in module install path)

gen_builddir()

Generate the (unique) name for the builddir

gen_installdir()

Generate the name of the installation directory.

get_checksum_for(checksums, filename=None, index=None)

Obtain checksum for given filename.

Parameters:
  • checksums – a list or tuple of checksums (or None)
  • filename – name of the file to obtain checksum for
  • index – index of file in list
static get_steps(run_test_cases=True, iteration_count=1)

Return a list of all steps to be performed.

guess_start_dir()

Return the directory where to start the whole configure/make/make install cycle from - typically self.src[0][‘finalpath’] - start_dir option – if abspath: use that – else, treat it as subdir for regular procedure

handle_iterate_opts()

Handle options relevant during iterated part of build/install procedure.

init_dry_run()

Initialise easyblock instance for performing a dry run.

install_step()

Install built software (abstract method).

load_dependency_modules()

Load dependency modules.

load_fake_module(purge=False)

Create and load fake module.

load_module(mod_paths=None, purge=True)

Load module for this software package/version, after purging all currently loaded modules.

make_builddir()

Create the build directory.

make_devel_module(create_in_builddir=False)

Create a develop module file which sets environment based on the build Usage: module load name, which loads the module you want to use. $EBDEVELNAME should then be the full path to the devel module file. So now you can module load $EBDEVELNAME.

WARNING: you cannot unload using $EBDEVELNAME (for now: use module unload basename $EBDEVELNAME)

make_dir(dir_name, clean, dontcreateinstalldir=False)

Create the directory.

make_installdir(dontcreate=None)

Create the installation directory.

make_module_dep(unload_info=None)

Make the dependencies for the module file.

Parameters:unload_info – dictionary with full module names as keys and module name to unload first as corr. value
make_module_description()

Create the module description.

make_module_extend_modpath()

Include prepend-path statements for extending $MODULEPATH.

make_module_extra(altroot=None, altversion=None)

Set extra stuff in module file, e.g. $EBROOT*, $EBVERSION*, etc.

Parameters:
  • altroot – path to use to define $EBROOT*
  • altversion – version to use to define $EBVERSION*
make_module_extra_extensions()

Sets optional variables for extensions.

Insert a footer section in the module file, primarily meant for contextual information

make_module_group_check()

Create the necessary group check.

make_module_req()

Generate the environment-variables to run the module.

make_module_req_guess()

A dictionary of possible directories to look for.

make_module_step(fake=False)

Generate module file

Parameters:fake – generate ‘fake’ module in temporary location, rather than actual module file
mod_subdir

Subdirectory in module install path

moduleGenerator

Module generator (DEPRECATED, use self.module_generator instead).

name

Shortcut the get the module name.

obtain_file(filename, extension=False, urls=None, download_filename=None, force_download=False)

Locate the file with the given name - searches in different subdirectories of source path - supports fetching file from the web if path is specified as an url (i.e. starts with “http://:”) :param filename: filename of source :param extension: indicates whether locations for extension sources should also be considered :param urls: list of source URLs where this file may be available :param download_filename: filename with which the file should be downloaded, and then renamed to <filename> :force_download: always try to download file, even if it’s already available in source path

package_step()

Package installed software (e.g., into an RPM), if requested, using selected package tool.

patch_step(beginpath=None)

Apply the patches

permissions_step()

Finalize installation procedure: adjust permissions as configured, change group ownership (if requested). Installing user must be member of the group that it is changed to.

post_install_step()

Do some postprocessing - run post install commands if any were specified

prepare_for_extensions()

Also do this before (eg to set the template)

prepare_step(start_dir=True)

Pre-configure step. Set’s up the builddir just before starting configure

Parameters:start_dir – guess start directory based on unpacked sources
restore_iterate_opts()

Restore options that were iterated over

run_all_steps(run_test_cases)

Build and install this software. run_test_cases (bool): run tests after building (e.g.: make test)

run_step(step, step_methods)

Run step, returns false when execution should be stopped

sanity_check_rpath(rpath_dirs=None)

Sanity check binaries/libraries w.r.t. RPATH linking.

sanity_check_step(*args, **kwargs)

Do a sanity check on the installation - if any of the files/subdirectories in the installation directory listed

in sanity_check_paths are non-existent (or empty), the sanity check fails
short_mod_name

Short module name (not including subdirectory in module install path)

skip_extensions()

Called when self.skip is True - use this to detect existing extensions and to remove them from self.exts - based on initial R version

stage_install_step()

Install in a stage directory before actual installation.

test_cases_step()

Run provided test cases.

test_step()

Run unit tests provided by software (if any).

toolchain

Toolchain used to build this easyblock

update_config_template_run_step()

Update the the easyconfig template dictionary with easyconfig.TEMPLATE_NAMES_EASYBLOCK_RUN_STEP names

version

Shortcut the get the module version.

exception easybuild.framework.easyblock.StopException

Bases: exceptions.Exception

StopException class definition.

easybuild.framework.easyblock.build_and_install_one(ecdict, init_env)

Build the software :param ecdict: dictionary contaning parsed easyconfig + metadata :param init_env: original environment (used to reset environment)

easybuild.framework.easyblock.build_easyconfigs(easyconfigs, output_dir, test_results)

Build the list of easyconfigs.

easybuild.framework.easyblock.get_easyblock_instance(ecdict)

Get an instance for this easyconfig :param easyconfig: parsed easyconfig (EasyConfig instance)

returns an instance of EasyBlock (or subclass thereof)

easybuild.framework.easyblock.inject_checksums(ecs, checksum_type)

Inject checksums of given type in specified easyconfig files

Parameters:
  • ecs – list of EasyConfig instances to inject checksums into corresponding files
  • checksum_type – type of checksum to use
easybuild.framework.easyblock.print_dry_run_note(loc, silent=True)

Print note on interpreting dry run output.