diff options
Diffstat (limited to 'lib/python2.7/Tools/scripts/checkpip.py')
-rw-r--r-- | lib/python2.7/Tools/scripts/checkpip.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/python2.7/Tools/scripts/checkpip.py b/lib/python2.7/Tools/scripts/checkpip.py new file mode 100644 index 0000000..1b6049d --- /dev/null +++ b/lib/python2.7/Tools/scripts/checkpip.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python2 +""" +Checks that the version of the projects bundled in ensurepip are the latest +versions available. +""" +import ensurepip +import json +import urllib2 +import sys + + +def main(): + outofdate = False + + for project, version in ensurepip._PROJECTS: + data = json.loads(urllib2.urlopen( + "https://pypi.python.org/pypi/{}/json".format(project), + ).read().decode("utf8")) + upstream_version = data["info"]["version"] + + if version != upstream_version: + outofdate = True + print("The latest version of {} on PyPI is {}, but ensurepip " + "has {}".format(project, upstream_version, version)) + + if outofdate: + sys.exit(1) + + +if __name__ == "__main__": + main() |