Update ensurepip from cpython 3.11.2

This commit is contained in:
CPython Developers
2023-02-28 20:00:09 +09:00
committed by Jeong YunWon
parent e082d8cc75
commit 1204996378
6 changed files with 18 additions and 9 deletions

View File

@@ -8,11 +8,10 @@ import tempfile
from importlib import resources
__all__ = ["version", "bootstrap"]
_PACKAGE_NAMES = ('setuptools', 'pip')
_SETUPTOOLS_VERSION = "58.1.0"
_PIP_VERSION = "22.0.4"
_SETUPTOOLS_VERSION = "65.5.0"
_PIP_VERSION = "22.3.1"
_PROJECTS = [
("setuptools", _SETUPTOOLS_VERSION, "py3"),
("pip", _PIP_VERSION, "py3"),
@@ -79,8 +78,8 @@ _PACKAGES = None
def _run_pip(args, additional_paths=None):
# Run the bootstraping in a subprocess to avoid leaking any state that happens
# after pip has executed. Particulary, this avoids the case when pip holds onto
# Run the bootstrapping in a subprocess to avoid leaking any state that happens
# after pip has executed. Particularly, this avoids the case when pip holds onto
# the files in *additional_paths*, preventing us to remove them at the end of the
# invocation.
code = f"""
@@ -90,8 +89,18 @@ sys.path = {additional_paths or []} + sys.path
sys.argv[1:] = {args}
runpy.run_module("pip", run_name="__main__", alter_sys=True)
"""
return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
"-c", code], check=True).returncode
cmd = [
sys.executable,
'-W',
'ignore::DeprecationWarning',
'-c',
code,
]
if sys.flags.isolated:
# run code in isolated mode if currently running isolated
cmd.insert(1, '-I')
return subprocess.run(cmd, check=True).returncode
def version():
@@ -164,9 +173,9 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
for name, package in _get_packages().items():
if package.wheel_name:
# Use bundled wheel package
from ensurepip import _bundled
wheel_name = package.wheel_name
whl = resources.read_binary(_bundled, wheel_name)
wheel_path = resources.files("ensurepip") / "_bundled" / wheel_name
whl = wheel_path.read_bytes()
else:
# Use the wheel package directory
with open(package.wheel_path, "rb") as fp:

View File

Binary file not shown.

Binary file not shown.