Skip to content

format

The main easyconfig format class

Authors:

  • Stijn De Weirdt (Ghent University)
  • Kenneth Hoste (Ghent University)

EBConfigObj

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] ... [ ] ... [ ] [[ ]] ... ...

__init__(configobj=None)

Initialise EBConfigObj instance

PARAMETER DESCRIPTION
configobj

ConfigObj instance

DEFAULT: None

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.

PARAMETER DESCRIPTION
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

PARAMETER DESCRIPTION
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.

PARAMETER DESCRIPTION
version

version to keep

tcname

toolchain name to keep

tcversion

toolchain version to keep

EasyConfigFormat

Bases: object

EasyConfigFormat class

comments property

Return comments in easyconfig file

__init__()

Initialise the EasyConfigFormat class

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

NestedDict

Bases: dict

A nested dictionary, with tracking of depth and parent

__init__(parent, depth)

Initialise NestedDict instance

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

Squashed

Bases: object

Class to ease the squashing of OrderedVersionOperators and OrderedToolchainVersionOperators

__init__()

Initialise Squashed instance

add_toolchain(squashed)

Add squashed instance from a toolchain section

PARAMETER DESCRIPTION
squashed

a Squashed instance

add_version(section, squashed)

Add squashed instance from version section

PARAMETER DESCRIPTION
section

the version section versionoperator instance

squashed

a Squashed instance

final()

Final squashing of version and toolchainversion operators and return the result

TopNestedDict

Bases: NestedDict

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

__init__(parent=None, depth=None)

Initialise TopNestedDict instance

get_format_version(txt)

Get the easyconfig format version as EasyVersion instance.

get_format_version_classes(version=None)

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