Skip to content

Commit 733ff9a

Browse files
authored
Merge pull request #4590 from youknowone/ensurepip
Update ensurepip from cpython 3.11.2
2 parents e082d8c + 1204996 commit 733ff9a

6 files changed

+18
-9
lines changed

Lib/ensurepip/__init__.py

+18-9
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
from importlib import resources
99

1010

11-
1211
__all__ = ["version", "bootstrap"]
1312
_PACKAGE_NAMES = ('setuptools', 'pip')
14-
_SETUPTOOLS_VERSION = "58.1.0"
15-
_PIP_VERSION = "22.0.4"
13+
_SETUPTOOLS_VERSION = "65.5.0"
14+
_PIP_VERSION = "22.3.1"
1615
_PROJECTS = [
1716
("setuptools", _SETUPTOOLS_VERSION, "py3"),
1817
("pip", _PIP_VERSION, "py3"),
@@ -79,8 +78,8 @@ def _get_packages():
7978

8079

8180
def _run_pip(args, additional_paths=None):
82-
# Run the bootstraping in a subprocess to avoid leaking any state that happens
83-
# after pip has executed. Particulary, this avoids the case when pip holds onto
81+
# Run the bootstrapping in a subprocess to avoid leaking any state that happens
82+
# after pip has executed. Particularly, this avoids the case when pip holds onto
8483
# the files in *additional_paths*, preventing us to remove them at the end of the
8584
# invocation.
8685
code = f"""
@@ -90,8 +89,18 @@ def _run_pip(args, additional_paths=None):
9089
sys.argv[1:] = {args}
9190
runpy.run_module("pip", run_name="__main__", alter_sys=True)
9291
"""
93-
return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
94-
"-c", code], check=True).returncode
92+
93+
cmd = [
94+
sys.executable,
95+
'-W',
96+
'ignore::DeprecationWarning',
97+
'-c',
98+
code,
99+
]
100+
if sys.flags.isolated:
101+
# run code in isolated mode if currently running isolated
102+
cmd.insert(1, '-I')
103+
return subprocess.run(cmd, check=True).returncode
95104

96105

97106
def version():
@@ -164,9 +173,9 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
164173
for name, package in _get_packages().items():
165174
if package.wheel_name:
166175
# Use bundled wheel package
167-
from ensurepip import _bundled
168176
wheel_name = package.wheel_name
169-
whl = resources.read_binary(_bundled, wheel_name)
177+
wheel_path = resources.files("ensurepip") / "_bundled" / wheel_name
178+
whl = wheel_path.read_bytes()
170179
else:
171180
# Use the wheel package directory
172181
with open(package.wheel_path, "rb") as fp:

Lib/ensurepip/_bundled/__init__.py

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)