2017-02-28 07:24:53 +00:00
|
|
|
# MIT licensed
|
2020-08-14 10:25:48 +00:00
|
|
|
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
2017-02-28 07:24:53 +00:00
|
|
|
|
2020-08-14 12:04:05 +00:00
|
|
|
from nvchecker_source import cmd # type: ignore
|
2013-11-03 10:21:50 +00:00
|
|
|
|
2018-05-05 15:39:02 +00:00
|
|
|
async def get_version(name, conf, **kwargs):
|
2015-11-05 12:47:46 +00:00
|
|
|
referree = conf.get('pacman') or name
|
2019-11-18 08:56:53 +00:00
|
|
|
c = "LANG=C pacman -Si %s | grep -F Version | awk '{print $3}' | head -n 1" % referree
|
2013-11-03 10:21:50 +00:00
|
|
|
conf['cmd'] = c
|
2020-08-14 10:25:48 +00:00
|
|
|
strip_release = conf.get('strip_release', False)
|
2015-08-24 16:18:19 +00:00
|
|
|
|
2020-08-14 10:25:48 +00:00
|
|
|
version = await cmd.get_version(name, conf, **kwargs)
|
2015-08-24 16:18:19 +00:00
|
|
|
|
2017-07-04 09:04:29 +00:00
|
|
|
if strip_release and '-' in version:
|
|
|
|
version = version.rsplit('-', 1)[0]
|
2017-07-08 07:59:54 +00:00
|
|
|
return version
|