summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/checkpip.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2013-11-11 12:11:55 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2013-11-11 12:11:55 (GMT)
commitd0cf0635b3f73742a91a100b1f19b8f9edf7be9a (patch)
tree6c4853bfa7ccb6eaf63fbfe3a41460ac6187bfe5 /Tools/scripts/checkpip.py
parent020af2a2bc4708215360a3793b5a1790e15d05dd (diff)
downloadcpython-d0cf0635b3f73742a91a100b1f19b8f9edf7be9a.zip
cpython-d0cf0635b3f73742a91a100b1f19b8f9edf7be9a.tar.gz
cpython-d0cf0635b3f73742a91a100b1f19b8f9edf7be9a.tar.bz2
Close #19406: Initial implementation of ensurepip
Patch by Donald Stufft and Nick Coghlan
Diffstat (limited to 'Tools/scripts/checkpip.py')
-rw-r--r--Tools/scripts/checkpip.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/Tools/scripts/checkpip.py b/Tools/scripts/checkpip.py
new file mode 100644
index 0000000..835101e
--- /dev/null
+++ b/Tools/scripts/checkpip.py
@@ -0,0 +1,32 @@
+#/usr/bin/env python3
+"""
+Checks that the version of the projects bundled in ensurepip are the latest
+versions available.
+"""
+import ensurepip
+import json
+import urllib.request
+import sys
+
+
+def main():
+ outofdate = False
+
+ for project, version in ensurepip._PROJECTS:
+ data = json.loads(urllib.request.urlopen(
+ "https://pypi.python.org/pypi/{}/json".format(project),
+ cadefault=True,
+ ).read().decode("utf8"))
+ upstream_version = data["info"]["version"]
+
+ if version != upstream_version:
+ outofdate = True
+ print("The latest version of {} on PyPI is {}, but ensurepip "
+ "has {}".format(project, upstream_version, version))
+
+ if outofdate:
+ sys.exit(1)
+
+
+if __name__ == "__main__":
+ main()