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: object

An 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: Enum

Configuration types.

Associated with their config subdirectory and their default extension.

COMPILER = 1
CRITERION = 4
GROUP = 5
MACHINE = 3
PLUGIN = 6
PROFILE = 0
RUNTIME = 2
classmethod all_kinds()[source]

Get a list of all ConfigTypes.

Return type:

list[Self]

classmethod fromstr(kind)[source]

Get Scope from user str.

Return type:

Optional[Self]

classmethod get_file_ext(ck)[source]

Get file type from ConfigType.

Return type:

str

class pcvs.helpers.storage.ConfigLocator[source]

Bases: object

Helper to find and list config.

Init a Config Locator.

EXEC_PATH: str | None = None
check_filename_ext(file_name, kind)[source]

Check of filename.

Return type:

Path

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:

ConfigDesc

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]

class pcvs.helpers.storage.ConfigScope(*values)[source]

Bases: Enum

Storage Scope Enumeration.

Variables:
  • GLOBAL – pcvs installation path

  • USER – user Home directory

  • LOCAL – current testing directory

GLOBAL = 0
LOCAL = 2
USER = 1
classmethod all_scopes()[source]

Get all possible scopes.

Return type:

list[Self]

classmethod fromstr(scope)[source]

Get Scope from user str.

Return type:

Optional[Self]

pcvs.helpers.storage.set_exec_path(exec_path)[source]

Set EXEC_PATH.

Return type:

None