easybuild.framework.easyconfig.format.format module

The main easyconfig format class

author:Stijn De Weirdt (Ghent University)
author:Kenneth Hoste (Ghent University)
class easybuild.framework.easyconfig.format.format.EBConfigObj(configobj=None)

Bases: object

Enhanced ConfigObj, version/toolchain and other easyconfig specific aspects aware

Given ConfigObj instance, make instance that represents a parser

Mandatory/minimal (to mimic v1.0 behaviour); first version/toolchain is the default [SUPPORTED] versions=version_operator toolchains=toolchain_version_operator

Optional [DEFAULT] ... [<operatorX> <versionX>] ... [<toolchainA> <operatorA> <versionA>] [[<operatorY> <versionY>]] ... ...

KNOWN_VERSION_MARKER_TYPES = [<class 'easybuild.framework.easyconfig.format.version.ToolchainVersionOperator'>, <class 'easybuild.framework.easyconfig.format.version.VersionOperator'>]
SECTION_MARKER_DEFAULT = 'DEFAULT'
SECTION_MARKER_DEPENDENCIES = 'DEPENDENCIES'
SECTION_MARKER_SUPPORTED = 'SUPPORTED'
VERSION_OPERATOR_VALUE_TYPES = {'toolchains': <class 'easybuild.framework.easyconfig.format.version.ToolchainVersionOperator'>, 'versions': <class 'easybuild.framework.easyconfig.format.version.VersionOperator'>}
get_specs_for(version=None, tcname=None, tcversion=None)

Return dictionary with specifications listed in sections applicable for specified info.

get_version_toolchain(version=None, tcname=None, tcversion=None)

Return tuple of version, toolchainname and toolchainversion (possibly using defaults).

parse(configobj)

Parse configobj using using recursive parse_sections. Then split off the default and supported sections.

Parameters:configobj – ConfigObj instance
parse_sections(toparse, current)

Parse Section instance; convert all supported sections, keys and values to their respective representations

Returns a dict of (nested) Sections

Parameters:
  • toparse – a Section (or ConfigObj) instance, basically a dict of (unparsed) sections
  • current – the current NestedDict
squash(version, tcname, tcversion)

Project the multidimensional easyconfig to single easyconfig It (tries to) detect conflicts in the easyconfig.

Parameters:
  • version – version to keep
  • tcname – toolchain name to keep
  • tcversion – toolchain version to keep
class easybuild.framework.easyconfig.format.format.EasyConfigFormat

Bases: object

EasyConfigFormat class

USABLE = False
VERSION = LooseVersion ('0.0')
dump(ecfg, default_values, templ_const, templ_val)

Dump easyconfig according to this format. This is higly version specific

extract_comments(rawtxt)

Extract comments from raw content.

get_config_dict()

Returns a single easyconfig dictionary.

parse(txt, **kwargs)

Parse the txt according to this format. This is highly version specific

set_specifications(specs)

Set specifications.

validate()

Verify the easyconfig format

class easybuild.framework.easyconfig.format.format.NestedDict(parent, depth)

Bases: dict

A nested dictionary, with tracking of depth and parent

copy()

Return a copy. Any relation between key and value are deepcopied away.

get_nested_dict()

Return an instance of NestedDict with this instance as parent

class easybuild.framework.easyconfig.format.format.Squashed

Bases: object

Class to ease the squashing of OrderedVersionOperators and OrderedToolchainVersionOperators

add_toolchain(squashed)

Add squashed instance from a toolchain section :param squashed: a Squashed instance

add_version(section, squashed)

Add squashed instance from version section :param section: the version section versionoperator instance :param squashed: a Squashed instance

final()

Final squashing of version and toolchainversion operators and return the result

class easybuild.framework.easyconfig.format.format.TopNestedDict(parent=None, depth=None)

Bases: easybuild.framework.easyconfig.format.format.NestedDict

The top level nested dictionary (depth 0, parent is itself)

easybuild.framework.easyconfig.format.format.get_format_version(txt)

Get the easyconfig format version as EasyVersion instance.

easybuild.framework.easyconfig.format.format.get_format_version_classes(version=None)

Return the (usable) subclasses from EasyConfigFormat that have a matching version.