Python - Check package versions
Python
code posted
created at 25 Jun 18:25
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#!/usr/bin/env python import xmlrpclib import pip pypi = xmlrpclib.ServerProxy('http://pypi.python.org/pypi') for dist in pip.get_installed_distributions(): available = pypi.package_releases(dist.project_name) if not available: # Try to capitalize pkg name available = pypi.package_releases(dist.project_name.capitalize()) if not available: msg = 'no releases at pypi' elif available[0] != dist.version: msg = '{} available'.format(available[0]) else: msg = 'up to date' pkg_info = '{dist.project_name} {dist.version}'.format(dist=dist) print '{pkg_info:40} {msg}'.format(pkg_info=pkg_info, msg=msg) |
699 Bytes in 2 ms with coderay