diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py index 3fbe8b2a5b1..1a2f57c07ba 100644 --- a/Lib/ensurepip/__init__.py +++ b/Lib/ensurepip/__init__.py @@ -8,11 +8,10 @@ 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 @@ def _get_packages(): 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 @@ def _run_pip(args, additional_paths=None): 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: diff --git a/Lib/ensurepip/_bundled/__init__.py b/Lib/ensurepip/_bundled/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl b/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl deleted file mode 100644 index 7ba048e2452..00000000000 Binary files a/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl and /dev/null differ diff --git a/Lib/ensurepip/_bundled/pip-22.3.1-py3-none-any.whl b/Lib/ensurepip/_bundled/pip-22.3.1-py3-none-any.whl new file mode 100644 index 00000000000..c5b7753e757 Binary files /dev/null and b/Lib/ensurepip/_bundled/pip-22.3.1-py3-none-any.whl differ diff --git a/Lib/ensurepip/_bundled/setuptools-58.1.0-py3-none-any.whl b/Lib/ensurepip/_bundled/setuptools-58.1.0-py3-none-any.whl deleted file mode 100644 index 18c8c22958f..00000000000 Binary files a/Lib/ensurepip/_bundled/setuptools-58.1.0-py3-none-any.whl and /dev/null differ diff --git a/Lib/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl b/Lib/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl new file mode 100644 index 00000000000..123a13e2c6b Binary files /dev/null and b/Lib/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl differ