pcvs.helpers.storage module
Helper package to find configuration and plugin files in pcvs configuration directories.
- class pcvs.helpers.storage.ConfigDesc(name, path, kind, scope)[source]
Bases:
objectAn object to describe a config file.
Initialize a Config file object description.
- property exist: bool
Return if the file pointed by this config descriptor exist.
- property full_name: str
Get the full name of the config.
- property kind: ConfigKind
The type of the config.
- property name: str
The name of the config (with file extension).
- property path: Path
The path of the config.
- property scope: ConfigScope
The scope of the config.
- class pcvs.helpers.storage.ConfigKind(*values)[source]
Bases:
EnumConfiguration types.
Associated with their config subdirectory and their default extension.
- COMPILER = 1
- CRITERION = 4
- GROUP = 5
- MACHINE = 3
- PLUGIN = 6
- PROFILE = 0
- RUNTIME = 2
- class pcvs.helpers.storage.ConfigLocator[source]
Bases:
objectHelper to find and list config.
Init a Config Locator.
- EXEC_PATH: str | None = None
- find_config(file_name, kind, scope=None)[source]
Get a config file description from it’s name.
- Return type:
ConfigDesc|None
- get_storage_dir(scope, kind=None)[source]
Get config dir from config scope and config type.
- Return type:
Path
- get_storage_path(file_name, kind, scope)[source]
Get config path from config label name, config type and config scope.
- Return type:
Path
- list_all_configs(scope=None)[source]
List all configs types in all scopes.
- Return type:
list[ConfigDesc]
- list_configs(kind, scope=None)[source]
List configs of type ct in scopes cs.
- Return type:
list[ConfigDesc]
- parse_full(user_token, kind, should_exist)[source]
Parse [scope:[kind:]]label token.
- Return type:
ConfigDesc|str
- parse_full_raise(user_token, kind=None, should_exist=None)[source]
Parse use token and return and associated config file.
- Return type:
- parse_scope_and_kind(user_token, default_kind=None)[source]
Parse scope[:kind] token, return None on failure.
- Return type:
tuple[ConfigScope|None,ConfigKind|None] |str
- parse_scope_and_kind_raise(user_token)[source]
Parse scope[:kind] token, raise on failure.
- Return type:
tuple[ConfigScope|None,ConfigKind|None]