def clone_repos()

in scripts/test-examples.py [0:0]


def clone_repos(config, target):
    if not target:
        Out.error("Unable to determine the target path for the cloned repos,"
                  " make sure the config defines a target value.")
        exit(-2)
    if not os.path.exists(target):
        Out.info(f"Dir [{target}] is missing, creating... ")
        os.mkdir(target)

    cloned_repos = []

    git_uris = config["repositories"]
    if not git_uris:
        Out.error("The repositories to clone are missing, make sure the config file defines a repos section.")
        exit(-2)
    for g_uri in git_uris:
        try:
            cloned_repo = git.Git(target).clone(g_uri)
            if cloned_repo:
                cloned_repos.append(cloned_repo)
                Out.info(f"Repository [{g_uri}] cloned to [{target}].")
        except git.exc.GitCommandError as git_error:
            Out.warn(f"Unable to clone [{g_uri}].", git_error)