blob: 8a64eda34af610c28c7c680fc01a4886808e4294 [file] [log] [blame]
Serhiy Storchaka8f8ec922014-01-16 17:33:23 +02001#!/usr/bin/env python3
Nick Coghland0cf0632013-11-11 22:11:55 +10002"""
3Checks that the version of the projects bundled in ensurepip are the latest
4versions available.
5"""
6import ensurepip
7import json
8import urllib.request
9import sys
10
11
12def 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
31if __name__ == "__main__":
32 main()