1#!/usr/bin/env python2 2""" 3Checks that the version of the projects bundled in ensurepip are the latest 4versions available. 5""" 6import ensurepip 7import json 8import urllib2 9import sys 10 11 12def main(): 13 outofdate = False 14 15 for project, version in ensurepip._PROJECTS: 16 data = json.loads(urllib2.urlopen( 17 "https://pypi.python.org/pypi/{}/json".format(project), 18 ).read().decode("utf8")) 19 upstream_version = data["info"]["version"] 20 21 if version != upstream_version: 22 outofdate = True 23 print("The latest version of {} on PyPI is {}, but ensurepip " 24 "has {}".format(project, upstream_version, version)) 25 26 if outofdate: 27 sys.exit(1) 28 29 30if __name__ == "__main__": 31 main() 32