INNER CODE UNIT · Python

github_slug

toyota-connected/ivi-homescreen · scripts/gen_sbom.py:51

def github_slug(url):
    """owner/repo for a GitHub remote, or None when it is hosted elsewhere."""
    match = re.match(r"^(?:https://|git@)github\.com[/:]([^/]+)/(.+?)(?:\.git)?$", url)
    return f"{match.group(1)}/{match.group(2)}" if match else None


def submodules(root):
    """Each submodule as (path, url), in .gitmodules order."""
    config = configparser.ConfigParser()
    config.read(root / ".gitmodules")
    found = []
    for section in config.sections():
        if not section.startswith("submodule "):
            continue
        found.append((config[section]["path"], config[section]["url"]))
    return found

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…