Serhiy Storchaka | 8f8ec92 | 2014-01-16 17:33:23 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Nick Coghlan | d0cf063 | 2013-11-11 22:11:55 +1000 | [diff] [blame] | 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 urllib.request |
| 9 | import sys |
| 10 | |
| 11 | |
| 12 | def main(): |
| 13 | outofdate = False |
| 14 | |
| 15 | for project, version in ensurepip._PROJECTS: |
| 16 | data = json.loads(urllib.request.urlopen( |
| 17 | "https://pypi.python.org/pypi/{}/json".format(project), |
| 18 | cadefault=True, |
| 19 | ).read().decode("utf8")) |
| 20 | upstream_version = data["info"]["version"] |
| 21 | |
| 22 | if version != upstream_version: |
| 23 | outofdate = True |
| 24 | print("The latest version of {} on PyPI is {}, but ensurepip " |
| 25 | "has {}".format(project, upstream_version, version)) |
| 26 | |
| 27 | if outofdate: |
| 28 | sys.exit(1) |
| 29 | |
| 30 | |
| 31 | if __name__ == "__main__": |
| 32 | main() |