craftbeerpi4-pione/testversion.py

13 lines
411 B
Python
Raw Permalink Normal View History

2022-07-16 10:26:32 +02:00
import json
import sys
from urllib import request
from pkg_resources import parse_version
def versions(pkg_name):
url = f'https://pypi.python.org/pypi/{pkg_name}/json'
releases = json.loads(request.urlopen(url).read())['releases']
releases = sorted(releases, key=parse_version, reverse=True)
return [releases[0]]
if __name__ == '__main__':
print(*versions(sys.argv[1]), sep='\n')