pypi source: use packaging.version.Version directly

This commit is contained in:
lilydjwg 2021-01-15 15:40:23 +08:00
parent 491a71add7
commit e09750b7a2
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
# Copyright (c) 2013-2021 lilydjwg <lilydjwg@gmail.com>, et al.
from pkg_resources import parse_version
from packaging.version import Version
async def get_version(name, conf, *, cache, **kwargs):
package = conf.get('pypi') or name
@ -14,7 +14,7 @@ async def get_version(name, conf, *, cache, **kwargs):
if use_pre_release:
version = sorted(
data['releases'].keys(),
key = parse_version,
key = Version,
)[-1]
else:
version = data['info']['version']

View File

@ -21,7 +21,7 @@ setup(
zip_safe = True,
packages = find_namespace_packages(exclude=['tests', 'build*', 'docs']),
install_requires = ['setuptools', 'toml', 'structlog', 'appdirs', 'tornado>=6', 'pycurl'],
install_requires = ['setuptools', 'packaging', 'toml', 'structlog', 'appdirs', 'tornado>=6', 'pycurl'],
extras_require = {
'vercmp': ['pyalpm'],
},