INNER CODE UNIT · Python
run
toyota-connected/ivi-homescreen · scripts/gen_sbom.py:45
def run(args, cwd):
return subprocess.run(
args, cwd=cwd, check=True, capture_output=True, text=True
).stdout.strip()
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():