easybuild.framework.easyconfig.format.format module¶
The main easyconfig format class
Authors:
- Stijn De Weirdt (Ghent University)
- Kenneth Hoste (Ghent University)
-
class
easybuild.framework.easyconfig.format.format.EBConfigObj(configobj=None)¶ Bases:
objectEnhanced 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:
objectEasyConfigFormat class
-
USABLE= False¶
-
VERSION= LooseVersion ('0.0')¶
-
comments¶ Return comments in easyconfig file
-
dump(ecfg, default_values, templ_const, templ_val, toolchain_hierarchy=None)¶ Dump easyconfig according to this format. This is highly 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:
dictA 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:
objectClass 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.NestedDictThe 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.