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