ยปCore Development>Code coverage>Tools/scripts/checkpip.py

Python code coverage for Tools/scripts/checkpip.py

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