gui.model.load_repository

gui.model.load_repository(root)

Load the regen/ tree of a repository; a failure is a state, not an exception.

Parameters

Name Type Description Default
root Path | str The repository root, exactly as spotregen --root takes it. required

Returns

Name Type Description
RepoState RepoState The spec, or the message, file and line of the failure.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen.gui.model import load_repository

with TemporaryDirectory() as tmp:
    state = load_repository(Path(tmp))
    print(state.ok, state.error.replace(tmp, "<tmp>"))
False [Errno 2] No such file or directory: '/private<tmp>/regen/architecture.toml'