mirror of
https://github.com/lilydjwg/nvchecker
synced 2025-01-16 11:13:58 +00:00
no need to return name now; we track this on the futures
This commit is contained in:
parent
774c36f4fe
commit
1bb14397ed
@ -122,7 +122,7 @@ class Source:
|
||||
def future_done(self, fu):
|
||||
name = fu.name
|
||||
try:
|
||||
_, version = fu.result()
|
||||
version = fu.result()
|
||||
if version is not None:
|
||||
self.print_version_update(name, version)
|
||||
except Exception:
|
||||
|
@ -19,4 +19,3 @@ async def get_version(name, conf):
|
||||
return await func(name, conf)
|
||||
else:
|
||||
logger.error('%s: no idea to get version info.', name)
|
||||
return name, None
|
||||
|
@ -16,7 +16,7 @@ async def get_version(name, conf):
|
||||
|
||||
if not data['results']:
|
||||
logger.error('Arch package not found: %s', name)
|
||||
return name, None
|
||||
return
|
||||
|
||||
r = [r for r in data['results'] if r['repo'] != 'testing'][0]
|
||||
if strip_release:
|
||||
@ -24,4 +24,4 @@ async def get_version(name, conf):
|
||||
else:
|
||||
version = r['pkgver'] + '-' + r['pkgrel']
|
||||
|
||||
return name, version
|
||||
return version
|
||||
|
@ -16,9 +16,9 @@ async def get_version(name, conf):
|
||||
|
||||
if not data['results']:
|
||||
logger.error('AUR upstream not found for %s', name)
|
||||
return name, None
|
||||
return
|
||||
|
||||
version = data['results'][0]['Version']
|
||||
if strip_release and '-' in version:
|
||||
version = version.rsplit('-', 1)[0]
|
||||
return name, version
|
||||
return version
|
||||
|
@ -28,4 +28,4 @@ async def get_version(name, conf):
|
||||
version = data[-1]
|
||||
else:
|
||||
version = data['values'][0]['date'].split('T', 1)[0].replace('-', '')
|
||||
return name, version
|
||||
return version
|
||||
|
@ -13,6 +13,6 @@ async def get_version(name, conf):
|
||||
output = (await p.communicate())[0].strip().decode('latin1')
|
||||
if p.returncode != 0:
|
||||
logger.error('%s: command exited with %d.', name, p.returncode)
|
||||
return name, None
|
||||
return
|
||||
|
||||
return name, output
|
||||
return output
|
||||
|
@ -11,4 +11,4 @@ async def get_version(name, conf):
|
||||
async with session.get(API_URL % name) as res:
|
||||
data = await res.json()
|
||||
version = [v['num'] for v in data['versions'] if not v['yanked']][0]
|
||||
return name, version
|
||||
return version
|
||||
|
@ -18,7 +18,7 @@ async def get_version(name, conf):
|
||||
|
||||
if not data.get('versions'):
|
||||
logger.error('Debian package not found: %s', name)
|
||||
return name, None
|
||||
return
|
||||
|
||||
r = data['versions'][0]
|
||||
if strip_release:
|
||||
@ -26,4 +26,4 @@ async def get_version(name, conf):
|
||||
else:
|
||||
version = r['version']
|
||||
|
||||
return name, version
|
||||
return version
|
||||
|
@ -42,4 +42,4 @@ async def get_version(name, conf):
|
||||
# YYYYMMDD.HHMMSS
|
||||
version = data[0]['commit']['committer']['date'] \
|
||||
.rstrip('Z').replace('-', '').replace(':', '').replace('T', '.')
|
||||
return name, version
|
||||
return version
|
||||
|
@ -25,7 +25,7 @@ async def get_version(name, conf):
|
||||
token = conf.get('token', os.environ.get(env_name, None))
|
||||
if token is None:
|
||||
logger.error('%s: No gitlab token specified.', name)
|
||||
return name, None
|
||||
return
|
||||
|
||||
if use_max_tag:
|
||||
url = GITLAB_MAX_TAG % (host, repo)
|
||||
@ -41,4 +41,4 @@ async def get_version(name, conf):
|
||||
version = data[-1]
|
||||
else:
|
||||
version = data[0]['created_at'].split('T', 1)[0].replace('-', '')
|
||||
return name, version
|
||||
return version
|
||||
|
@ -2,4 +2,4 @@
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
async def get_version(name, conf):
|
||||
return name, conf.get('manual')
|
||||
return conf.get('manual')
|
||||
|
@ -9,8 +9,8 @@ async def get_version(name, conf):
|
||||
conf['cmd'] = c
|
||||
strip_release = conf.getboolean('strip-release', False)
|
||||
|
||||
_, version = await cmd.get_version(name, conf)
|
||||
version = await cmd.get_version(name, conf)
|
||||
|
||||
if strip_release and '-' in version:
|
||||
version = version.rsplit('-', 1)[0]
|
||||
return name, version
|
||||
return version
|
||||
|
@ -15,7 +15,7 @@ async def get_version(name, conf):
|
||||
regex = re.compile(conf['regex'])
|
||||
except sre_constants.error:
|
||||
logger.warn('%s: bad regex, skipped.', name, exc_info=True)
|
||||
return name, None
|
||||
return
|
||||
|
||||
encoding = conf.get('encoding', 'latin1')
|
||||
|
||||
@ -34,4 +34,4 @@ async def get_version(name, conf):
|
||||
except ValueError:
|
||||
version = None
|
||||
logger.error('%s: version string not found.', name)
|
||||
return name, version
|
||||
return version
|
||||
|
@ -15,6 +15,6 @@ def simple_json(urlpat, confkey, version_from_json):
|
||||
async with session.get(url, **kwargs) as res:
|
||||
data = await res.json()
|
||||
version = version_from_json(data)
|
||||
return name, version
|
||||
return version
|
||||
|
||||
return get_version
|
||||
|
@ -25,7 +25,7 @@ async def get_version(name, conf):
|
||||
|
||||
if not data.get('entries'):
|
||||
logger.error('Ubuntu package not found: %s', name)
|
||||
return name, None
|
||||
return
|
||||
|
||||
releases = [r for r in data["entries"] if r["status"] == "Published"]
|
||||
|
||||
@ -39,10 +39,11 @@ async def get_version(name, conf):
|
||||
|
||||
if not releases:
|
||||
logger.error('Ubuntu package not found: %s', name)
|
||||
return
|
||||
|
||||
if strip_release:
|
||||
version = releases[0]['source_package_version'].split("-")[0]
|
||||
else:
|
||||
version = releases[0]['source_package_version']
|
||||
|
||||
return name, version
|
||||
return version
|
||||
|
@ -39,16 +39,16 @@ async def get_version(name, conf):
|
||||
output = (await p.communicate())[0].strip().decode('latin1')
|
||||
if p.returncode != 0:
|
||||
logger.error('%s: command exited with %d.', name, p.returncode)
|
||||
return name, None
|
||||
return
|
||||
else:
|
||||
if use_max_tag:
|
||||
data = [tag for tag in output.split("\n") if tag not in ignored_tags]
|
||||
data.sort(key=parse_version)
|
||||
version = data[-1]
|
||||
return name, version
|
||||
return version
|
||||
else:
|
||||
oldver = _parse_oldver(oldver)
|
||||
if output == oldver[2]:
|
||||
return name, None
|
||||
return
|
||||
else:
|
||||
return name, "%d.%d.%s" % (oldver[0], oldver[1] + 1, output)
|
||||
return "%d.%d.%s" % (oldver[0], oldver[1] + 1, output)
|
||||
|
@ -13,7 +13,7 @@ async def get_version():
|
||||
_config.read_dict({name: config})
|
||||
config = _config[name]
|
||||
|
||||
return (await _get_version(name, config))[1]
|
||||
return await _get_version(name, config)
|
||||
|
||||
return __call__
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user