mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-18 04:34:44 +00:00
18 lines
509 B
Python
18 lines
509 B
Python
# MIT licensed
|
|
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
|
|
|
PACKAGIST_URL = 'https://packagist.org/packages/%s.json'
|
|
|
|
async def get_version(name, conf, *, cache, **kwargs):
|
|
key = conf.get('packagist', name)
|
|
data = await cache.get_json(PACKAGIST_URL % key)
|
|
|
|
versions = {
|
|
version: details
|
|
for version, details in data["package"]['versions'].items()
|
|
if version != "dev-master"
|
|
}
|
|
|
|
if len(versions):
|
|
return max(versions, key=lambda version: versions[version]["time"])
|