Skip to content

parser

This describes the easyconfig parser

The parser is format version aware

Authors:

  • Stijn De Weirdt (Ghent University)

EasyConfigParser

Bases: object

Read the easyconfig file, return a parsed config object Can contain references to multiple version and toolchain/toolchain versions

__init__(filename=None, format_version=None, rawcontent=None, auto_convert_value_types=True)

Initialise the EasyConfigParser class

PARAMETER DESCRIPTION
filename

path to easyconfig file to parse (superseded by rawcontent, if specified)

DEFAULT: None

format_version

version of easyconfig file format, used to determine how to parse supplied easyconfig

DEFAULT: None

rawcontent

raw content of easyconfig file to parse (preferred over easyconfig supplied via filename)

DEFAULT: None

auto_convert_value_types

indicates whether types of easyconfig values should be automatically converted in case they are wrong

DEFAULT: True

check_values_types(cfg)

Check types of easyconfig parameter values.

PARAMETER DESCRIPTION
cfg

dictionary with easyconfig parameter values (result of get_config_dict())

dump(ecfg, default_values, templ_const, templ_val, toolchain_hierarchy=None)

Dump easyconfig in format it was parsed from.

get_config_dict(validate=True)

Return parsed easyconfig as a dict.

process(filename=None)

Create an instance

set_format_text()

Create the text for the formatter instance

set_specifications(specs)

Set specifications.

write(filename=None)

Write the easyconfig format instance, using content in self.rawcontent.

fetch_parameters_from_easyconfig(rawtxt, params)

Fetch (initial) parameter definition from the given easyconfig file contents.

PARAMETER DESCRIPTION
rawtxt

contents of the easyconfig file

params

list of parameter names to fetch values for