nvchecker/nvchecker_source/git.py
Felix Yan c9b689d67b
Add a git source
It's a thin wrapper around the cmd source, and reuses its get_cmd
function.
2020-09-24 04:26:12 +08:00

15 lines
366 B
Python

# MIT licensed
# Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al.
import re
from nvchecker_source.cmd import run_cmd
async def get_version(
name, conf, *, cache, keymanager=None
):
git = conf['git']
cmd = f"git ls-remote -t --refs {git}"
data = await cache.get(cmd, run_cmd)
regex = "(?<=refs/tags/).*$"
return re.findall(regex, data)