easybuild.framework.easyconfig.easyconfig module

Easyconfig module that contains the EasyConfig class.

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:Alan O’Cais (Juelich Supercomputing Centre)
author:Bart Oldeman (McGill University, Calcul Quebec, Compute Canada)
author:Maxime Boissonneault (Universite Laval, Calcul Quebec, Compute Canada)
author:Victor Holanda (CSCS, ETH Zurich)
class easybuild.framework.easyconfig.easyconfig.ActiveMNS(*args, **kwargs)

Bases: abc.BaseActiveMNS

Wrapper class for active module naming scheme.

check_ec_type(ec, raise_error=True)

Obtain a full parsed easyconfig file to pass to naming scheme methods if provided keys are insufficient.

  • ec – available easyconfig parameter specifications (EasyConfig instance or dict value)
  • raise_error – boolean indicating whether or not an error should be raised if a full easyconfig is required but not found
det_devel_module_filename(ec, force_visible=False)

Determine devel module filename.

det_full_module_name(ec, force_visible=False, require_result=True)

Determine full module name by selected module naming scheme, based on supplied easyconfig.


Determine initial modulepaths according to module naming scheme.


Determine name of software installation subdirectory.


Determine modulepath extensions according to module naming scheme.


Determine module subdirectory according to module naming scheme.

Determine list of paths in which symlinks to module files must be created.

det_short_module_name(ec, force_visible=False)

Determine short module name according to module naming scheme.


Determine user-specific modulepath extensions according to module naming scheme.


Determine whether load statements for a toolchain should be expanded to load statements for its dependencies. This is useful when toolchains are not exposed to users.

is_short_modname_for(short_modname, name)

Determine whether the specified (short) module name is a module for software with the specified name.


Check whether specified list of easyconfig parameters is sufficient for active module naming scheme.

class easybuild.framework.easyconfig.easyconfig.EasyConfig(path, extra_options=None, build_specs=None, validate=True, hidden=None, rawtxt=None, auto_convert_value_types=True, local_var_naming_check=None)

Bases: object

Class which handles loading, reading, validation of easyconfigs


Return list of all dependencies, incl. hidden/build deps & toolchain, but excluding filtered deps.


Return dict representation of this EasyConfig instance.


Return a flat list of the parsed build dependencies When builddependencies are iterable they are flattened lists with duplicates removed outside of the iterating process, because the callers want simple lists.


Check whether this easyconfig file is deprecated.


Return a copy of this EasyConfig instance.


Determine number of files (sources + patches) required for this easyconfig.

dep_is_filtered(dep, filter_deps_specs)

Returns True if a dependency is filtered according to the filter_deps_specs


Returns an array of parsed dependencies (after filtering, if requested) dependency = {‘name’: ‘’, ‘version’: ‘’, ‘system’: (False|True), ‘versionsuffix’: ‘’, ‘toolchain’: ‘’} Iterable builddependencies are flattened when not iterating.

Parameters:build_only – only return build dependencies, discard others

Temporarily disable templating on the given EasyConfig

with ec.disable_templating():
# Do what you want without templating

# Templating set to previous value

dump(fp, always_overwrite=True, backup=False, explicit_toolchains=False)

Dump this easyconfig to file, with the given filename.

  • always_overwrite – overwrite existing file at specified location without use of –force
  • backup – create backup of existing file before overwriting it
extend_params(extra, overwrite=True)

Extend list of known parameters via provided list of extra easyconfig parameters.


Determine correct filename for this easyconfig file.


Filter dependencies according to ‘filter-deps’ configuration setting.


Replace dependencies by hidden dependencies in list of (build) dependencies, where appropriate.


Try to generate all template values.

get(key, *args, **kwargs)

Check whether any replace easyconfig parameters are still used


Get template value based on –cuda-compute-capabilities EasyBuild configuration option and cuda_compute_capabilities easyconfig parameter. Returns user-friendly error message in case neither are defined, or if an unknown key is used.


Get list of lists of parsed dependencies that correspond with entries in multi_deps easyconfig parameter.


Obtain reference to original/untemplated value of specified easyconfig parameter rather than a copied value with templated values.


Helper function for _parse_dependency; collects metadata for external module dependencies.

Parameters:mod_name – name of external module to collect metadata for

Handle lists of dependency versions of which we should iterate specified in ‘multi_deps’ easyconfig parameter.

This is basically just syntactic sugar to prevent having to specify a list of lists in ‘builddependencies’.


Check whether specified easyconfig parameter is mandatory.


Deal with local variables that do not follow the recommended naming scheme (if any).


returns name


Parse the file and set options mandatory requirements are checked here


Parse specifications for which dependencies should be filtered.


Parse provided version specification as a version range.

probe_external_module_metadata(mod_name, existing_metadata=None)

Helper function for handle_external_module_metadata.

Tries to determine metadata for external module when there is not entry in the metadata file, by looking at the variables defined by the module file.

This is mainly intended for modules provided in the Cray Programming Environment, but it could also be useful in other contexts.

The following pairs of variables are considered (in order, first hit wins), where ‘XXX’ is the software name in capitals:


If none of the pairs is found, then an empty dictionary is returned.

  • mod_name – name of the external module
  • metadata – already available metadata for this external module (if any)

Set keys in this EasyConfig instance based on supplied easyconfig parameter values.

If any unknown easyconfig parameters are encountered here, an error is raised.

Parameters:params – a dict value with names/values of easyconfig parameters to set

Start iterative mode.


Stop iterative mode.


returns the Toolchain used

update(key, value, allow_duplicate=True)

Update an easyconfig parameter with the specified value (i.e. append to it). Note: For dictionary easyconfig parameters, ‘allow_duplicate’ is ignored (since it’s meaningless).


Validate this easyonfig - ensure certain easyconfig parameters are set to a known value (see self.validations) - check OS dependencies - check license


Configure/build/install options specified as lists should have same length.


Validate the license


validate presence of OS dependencies osdependencies should be a single list


returns version


Clean up easyconfigs (in place) by filtering out comments/buildstats included by EasyBuild in archived easyconfigs (cfr. FileRepository.add_easyconfig in easybuild.tools.repository.filerepo)

Parameters:paths – list of paths to easyconfigs to clean up
easybuild.framework.easyconfig.easyconfig.copy_easyconfigs(paths, target_dir)

Copy easyconfig files to specified directory, in the ‘right’ location and using the filename expected by robot.

  • paths – list of paths to copy to git working dir
  • target_dir – target directory

dict with useful information on copied easyconfig files (corresponding EasyConfig instances, paths, status)

easybuild.framework.easyconfig.easyconfig.copy_patch_files(patch_specs, target_dir)

Copy patch files to specified directory, in the ‘right’ location according to the software name they relate to.

  • patch_specs – list of tuples with patch file location and name of software they are for
  • target_dir – target directory
easybuild.framework.easyconfig.easyconfig.create_paths(path, name, version)

Returns all the paths where easyconfig could be located <path> is the basepath <name> should be a string <version> can be a ‘*’ if you use glob patterns, or an install version otherwise

easybuild.framework.easyconfig.easyconfig.det_file_info(paths, target_dir)

Determine useful information on easyconfig files relative to a target directory, before any actual operation (e.g. copying) is performed

  • paths – list of paths to easyconfig files
  • target_dir – target directory

dict with useful information on easyconfig files (corresponding EasyConfig instances, paths, status) relative to a target directory

easybuild.framework.easyconfig.easyconfig.det_installversion(version, toolchain_name, toolchain_version, prefix, suffix)

Deprecated ‘det_installversion’ function, to determine exact install version, based on supplied parameters.

easybuild.framework.easyconfig.easyconfig.det_location_for(path, target_dir, soft_name, target_file)

Determine path to easyconfigs directory for specified software name, using specified target file name.

  • path – path of file to copy
  • target_dir – (parent) target directory, should contain easybuild/easyconfigs subdirectory
  • soft_name – software name (to determine location to copy to)
  • target_file – target file name

full path to the right location

easybuild.framework.easyconfig.easyconfig.det_subtoolchain_version(current_tc, subtoolchain_names, optional_toolchains, cands, incl_capabilities=False)

Returns unique version for subtoolchain, in tc dict. If there is no unique version: * use ‘’ for system, if system is not skipped. * return None for skipped subtoolchains, that is,

optional toolchains or system toolchain without add_system_to_minimal_toolchains.
  • in all other cases, raises an exception.

Temporarily disable templating on the given EasyConfig

with disable_templating(ec):
# Do what you want without templating

# Templating set to previous value


Fix use of deprecated functionality in easyconfigs at specified locations.

easybuild.framework.easyconfig.easyconfig.get_easyblock_class(easyblock, name=None, error_on_failed_import=True, error_on_missing_easyblock=None, **kwargs)

Get class for a particular easyblock (or use default)

easybuild.framework.easyconfig.easyconfig.get_module_path(name, generic=None, decode=True)

Determine the module path for a given easyblock or software name, based on the encoded class name.

  • generic – whether or not the easyblock is generic (if None: auto-derive from specified class name)
  • decode – whether or not to decode the provided class name
easybuild.framework.easyconfig.easyconfig.get_toolchain_hierarchy(parent_toolchain, incl_capabilities=False)

Determine list of subtoolchains for specified parent toolchain. Result starts with the most minimal subtoolchains first, ends with specified toolchain.

The system toolchain is considered the most minimal subtoolchain only if the add_system_to_minimal_toolchains build option is enabled.

The most complex hierarchy we have now is goolfc which works as follows:

goolfc /
gompic golfc(*)

/ (*) optional toolchains, not compulsory for backwards compatibility gcccuda golf(*)


/ |

GCCcore(*) |

(system: only considered if –add-system-to-minimal-toolchains configuration option is enabled)

  • parent_toolchain – dictionary with name/version of parent toolchain
  • incl_capabilities – also register toolchain capabilities in result

Decorator to handle deprecated/replaced easyconfig parameters.


Return whether specified easyblock name is a generic easyblock or not.


Determine whether provided variable name can be considered as the name of a local variable:

One of the following suffices to be considered a name of a local variable: * name starts with ‘local_’ or ‘_’ * name consists of a single letter * name is __builtins__ (which is always defined)


Determine ‘letter’ directory for specified software name. This usually just the 1st letter of the software name (in lowercase), except for funky software names, e.g. ones starting with a digit.

easybuild.framework.easyconfig.easyconfig.process_easyconfig(path, build_specs=None, validate=True, parse_only=False, hidden=None)

Process easyconfig, returning some information for each block :param path: path to easyconfig file :param build_specs: dictionary specifying build specifications (e.g. version, toolchain, …) :param validate: whether or not to perform validation :param parse_only: only parse easyconfig superficially (faster, but results in partial info) :param hidden: indicate whether corresponding module file should be installed hidden (‘.’-prefixed)

easybuild.framework.easyconfig.easyconfig.resolve_template(value, tmpl_dict)

Given a value, try to susbstitute the templated strings with actual values. - value: some python object (supported are string, tuple/list, dict or some mix thereof) - tmpl_dict: template dictionary

easybuild.framework.easyconfig.easyconfig.robot_find_easyconfig(name, version)

Find an easyconfig for module in path, returns (absolute) path to easyconfig file (or None, if none is found).

easybuild.framework.easyconfig.easyconfig.robot_find_subtoolchain_for_dep(dep, modtool, parent_tc=None, parent_first=False)

Find the subtoolchain to use for a dependency

  • dep – dependency target dict (long and short module names may not exist yet)
  • parent_tc – toolchain from which to derive the toolchain hierarchy to search (default: use dep’s toolchain)
  • parent_first – reverse order in which subtoolchains are considered: parent toolchain, then subtoolchains

minimal toolchain for which an easyconfig exists for this dependency (and matches build_options)


Function decorator to cache (and retrieve cached) toolchain hierarchy queries.

easybuild.framework.easyconfig.easyconfig.triage_easyconfig_params(variables, ec)

Triage supplied variables into known easyconfig parameters and other variables.

Unknown easyconfig parameters that have a single-letter name, or of which the name starts with ‘local_’ are considered to be local variables.

  • variables – dictionary with names/values of variables that should be triaged
  • ec – dictionary with set of known easyconfig parameters

2-tuple with dict of names/values for known easyconfig parameters + unknown (non-local) variables

easybuild.framework.easyconfig.easyconfig.verify_easyconfig_filename(path, specs, parsed_ec=None)

Check whether parsed easyconfig at specified path matches expected specs; this basically verifies whether the easyconfig filename corresponds to its contents

  • path – path to easyconfig file
  • specs – expected specs (dict with easyconfig parameter values)
  • parsed_ec – (list of) EasyConfig instance(s) corresponding to easyconfig file