1 | n/a | #!/usr/bin/env python3 |
---|
2 | n/a | """ |
---|
3 | n/a | Checks that the version of the projects bundled in ensurepip are the latest |
---|
4 | n/a | versions available. |
---|
5 | n/a | """ |
---|
6 | n/a | import ensurepip |
---|
7 | n/a | import json |
---|
8 | n/a | import urllib.request |
---|
9 | n/a | import sys |
---|
10 | n/a | |
---|
11 | n/a | |
---|
12 | n/a | def main(): |
---|
13 | n/a | outofdate = False |
---|
14 | n/a | |
---|
15 | n/a | for project, version in ensurepip._PROJECTS: |
---|
16 | n/a | data = json.loads(urllib.request.urlopen( |
---|
17 | n/a | "https://pypi.python.org/pypi/{}/json".format(project), |
---|
18 | n/a | cadefault=True, |
---|
19 | n/a | ).read().decode("utf8")) |
---|
20 | n/a | upstream_version = data["info"]["version"] |
---|
21 | n/a | |
---|
22 | n/a | if version != upstream_version: |
---|
23 | n/a | outofdate = True |
---|
24 | n/a | print("The latest version of {} on PyPI is {}, but ensurepip " |
---|
25 | n/a | "has {}".format(project, upstream_version, version)) |
---|
26 | n/a | |
---|
27 | n/a | if outofdate: |
---|
28 | n/a | sys.exit(1) |
---|
29 | n/a | |
---|
30 | n/a | |
---|
31 | n/a | if __name__ == "__main__": |
---|
32 | n/a | main() |
---|