easybuild.framework.easyconfig.tweak module

Easyconfig module that provides functionality for tweaking existing eaysconfig (.eb) files.

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:Fotis Georgatos (Uni.Lu, NTUA)

Return a suiting file name for the easyconfig file at <path>, as determined by its contents.

easybuild.framework.easyconfig.tweak.find_matching_easyconfigs(name, installver, paths)

Find easyconfigs that match specified name/installversion in specified list of paths.

  • name – software name
  • installver – software install version (which includes version, toolchain, versionprefix/suffix, …)
  • paths – list of paths to search easyconfigs in
easybuild.framework.easyconfig.tweak.obtain_ec_for(specs, paths, fp=None)

Obtain an easyconfig file to the given specifications.

Either select between available ones, or use the best suited available one to generate a new easyconfig file.

  • specs – list of available easyconfig files
  • paths – a list of paths where easyconfig files can be found
  • fp – the desired file name
easybuild.framework.easyconfig.tweak.pick_version(req_ver, avail_vers)

Pick version based on an optionally desired version and available versions.

If a desired version is specifed, the most recent version that is less recent than or equal to the desired version will be picked; else, the most recent version will be picked.

This function returns both the version to be used, which is equal to the required version if it was specified, and the version picked that matches that closest.

  • req_ver – required version
  • avail_vers – list of available versions
easybuild.framework.easyconfig.tweak.select_or_generate_ec(fp, paths, specs)

Select or generate an easyconfig file with the given requirements, from existing easyconfig files.

If easyconfig files are available for the specified software package, then this function will first try to determine which toolchain to use.

  • if a toolchain is given, it will use it (possible using a template easyconfig file as base);
  • if not, and only a single toolchain is available, is will assume it can use that toolchain
  • else, it fails – EasyBuild doesn’t select between multiple available toolchains

Next, it will trim down the selected easyconfig files to a single one, based on the following requirements (in order of preference):

  • toolchain version
  • software version
  • other parameters (e.g. versionprefix, versionsuffix, etc.)

If a complete match is found, it will return that easyconfig. Else, it will generate a new easyconfig file based on the selected ‘best matching’ easyconfig file.

easybuild.framework.easyconfig.tweak.tweak(easyconfigs, build_specs, modtool, targetdirs=None)

Tweak list of easyconfigs according to provided build specifications.

easybuild.framework.easyconfig.tweak.tweak_one(orig_ec, tweaked_ec, tweaks, targetdir=None)

Tweak an easyconfig file with the given list of tweaks, using replacement via regular expressions. Note: this will only work ‘well-written’ easyconfig files, i.e. ones that e.g. set the version once and then use the ‘version’ variable to construct the list of sources, and possibly other parameters that depend on the version (e.g. list of patch files, dependencies, version suffix, …)

The tweaks should be specified in a dictionary, with parameters and keys that map to the values to be set.

Reads easyconfig file at path <orig_ec>, and writes the tweaked easyconfig file to <tweaked_ec>.

If <tweaked_ec> is not provided, a target filepath is generated based on <targetdir> and the contents of the tweaked easyconfig file.

  • orig_ec – location of original easyconfig file to read
  • tweaked_ec – location where tweaked easyconfig file should be written (if this is None, then filename for tweaked easyconfig is auto-derived from contents)
  • tweaks – dictionary with set of changes to apply to original easyconfig file
  • targetdir – target directory for tweaked easyconfig file, defaults to temporary directory (only used if tweaked_ec is None)