Donald Stufft | 8aaff54 | 2014-11-11 10:24:11 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python2 |
| 2 | """ |
| 3 | Checks that the version of the projects bundled in ensurepip are the latest |
| 4 | versions available. |
| 5 | """ |
| 6 | import ensurepip |
| 7 | import json |
| 8 | import urllib2 |
| 9 | import sys |
| 10 | |
| 11 | |
| 12 | def 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 | |
| 30 | if __name__ == "__main__": |
| 31 | main() |