Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: e53c98563824cbb2f296f1de1f2185a7b5271cd6 authored by Larry Hastings on 19 August 2020, 19:56:53 UTC
Version bump and copyright update for 3.5.10rc1.
Tip revision: e53c985
checkpip.py
#!/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()
back to top