- Notifications
You must be signed in to change notification settings - Fork 31.7k
/
Copy pathcheckpip.py
31 lines (24 loc) · 758 Bytes
/
checkpip.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python2
"""
Checks that the version of the projects bundled in ensurepip are the latest
versions available.
"""
importensurepip
importjson
importurllib2
importsys
defmain():
outofdate=False
forproject, versioninensurepip._PROJECTS:
data=json.loads(urllib2.urlopen(
"https://pypi.python.org/pypi/{}/json".format(project),
).read().decode("utf8"))
upstream_version=data["info"]["version"]
ifversion!=upstream_version:
outofdate=True
print("The latest version of {} on PyPI is {}, but ensurepip "
"has {}".format(project, upstream_version, version))
ifoutofdate:
sys.exit(1)
if__name__=="__main__":
main()