mmeson.options module

Module containing definitions of Meson’s option format and the OptionsManager.

class mmeson.options.MesonType(value)

Bases: Enum

Enum for Meson’s option type. See Meson’s manual for details.

STRING = 'string'
BOOLEAN = 'boolean'
COMBO = 'combo'
INTEGER = 'integer'
ARRAY = 'array'
class mmeson.options.MesonSection(value)

Bases: Enum

Enum for Meson’s option section. See Meson’s manual for details.

CORE = 'core'
BACKEND = 'backend'
BASE = 'base'
COMPILER = 'compiler'
DIRECTORY = 'directory'
USER = 'user'
TEST = 'test'
class mmeson.options.MesonMachine(value)

Bases: Enum

Enum for Meson’s machine entry. See Meson’s manual for details.

ANY = 'any'
HOST = 'host'
BUILD = 'build'
class mmeson.options.Option(name: str, value, value_type: MesonType, description: str, choices: list[str], section: MesonSection, machine: MesonMachine)

Bases: object

Class containing the attributes of a Meson option. See Meson’s manual for details.

value_as_string() str

Converts the option value to a string such that it can be used to be passed to Meson’s CLI.

Returns

Option value formatted as string.

class mmeson.options.OptionsManager(*args, **kwargs)

Bases: object

Singleton class owning the list of all options.

options

list of Option list of all current options.

set_options(options: list[mmeson.options.Option]) None

Sets the options member and sorts it.

Parameters

options – List of options to use for options member.

get_options() list[mmeson.options.Option]
Returns

List of all options.

get_option(index: int) Option
Parameters

index – index of the option in the options list.

Returns

Option from the options list.

get_modified_options() list[mmeson.options.Option]
Returns

List of all modified options.

set_modified(index: int, value) None

Modify an option and mark it as modified.

Parameters
  • index – index of the option in the options list.

  • value – value to set according to the option’s MesonType.