Created
July 29, 2014 10:13
-
-
Save danigosa/12dda4c9416ec067f132 to your computer and use it in GitHub Desktop.
Py3K Version of pypi packages check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import xmlrpc.client as client | |
import pip | |
pypi = client.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" | |
is_new = False | |
elif available[0] != dist.version: | |
msg = "{} available".format(available[0]) | |
is_new = True | |
else: | |
msg = "up to date" | |
is_new = False | |
pkg_info = "{dist.project_name} {dist.version}".format(dist=dist) | |
if is_new: print("{pkg_info:40} {msg}".format(pkg_info=pkg_info, msg=msg)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment