forked from Rust-related/RustPython
Update ensurepip from cpython 3.11.2
This commit is contained in:
committed by
Jeong YunWon
parent
e082d8cc75
commit
1204996378
27
Lib/ensurepip/__init__.py
vendored
27
Lib/ensurepip/__init__.py
vendored
@@ -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:
|
||||
|
||||
0
Lib/ensurepip/_bundled/__init__.py
vendored
0
Lib/ensurepip/_bundled/__init__.py
vendored
BIN
Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl
vendored
BIN
Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl
vendored
Binary file not shown.
BIN
Lib/ensurepip/_bundled/pip-22.3.1-py3-none-any.whl
vendored
Normal file
BIN
Lib/ensurepip/_bundled/pip-22.3.1-py3-none-any.whl
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
Lib/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl
vendored
Normal file
BIN
Lib/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user