mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
pypi: fix sorting with use_pre_release=True
This commit is contained in:
parent
de6fc3b5ba
commit
89fe2988cc
1 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
|||
# MIT licensed
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
from pkg_resources import parse_version
|
||||
|
||||
from . import conf_cacheable_with_name, session
|
||||
|
||||
get_cacheable_conf = conf_cacheable_with_name('pypi')
|
||||
|
@ -15,7 +17,10 @@ async def get_version(name, conf, **kwargs):
|
|||
data = await res.json()
|
||||
|
||||
if use_pre_release:
|
||||
version = sorted(data['releases'].keys())[-1]
|
||||
version = sorted(
|
||||
data['releases'].keys(),
|
||||
key = parse_version,
|
||||
)[-1]
|
||||
else:
|
||||
version = data['info']['version']
|
||||
return version
|
||||
|
|
Loading…
Add table
Reference in a new issue