10000 [3.8] bpo-41490: Bump vendored pip to version 20.2.3 (GH-22527). by pablogsal · Pull Request #22545 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
8000

[3.8] bpo-41490: Bump vendored pip to version 20.2.3 (GH-22527). #22545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8000
Merged
merged 1 commit into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions Lib/ensurepip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
import sys
import runpy
import tempfile
import subprocess


__all__ = ["version", "bootstrap"]


_SETUPTOOLS_VERSION = "49.2.1"

_PIP_VERSION = "20.2.1"
_PIP_VERSION = "20.2.3"

_PROJECTS = [
("setuptools", _SETUPTOOLS_VERSION, "py3"),
Expand All @@ -20,22 +21,18 @@


def _run_pip(args, additional_paths=None):
# Add our bundled software to the sys.path so we can import it
if additional_paths is not None:
sys.path = additional_paths + sys.path

# Invoke pip as if it's the main module, and catch the exit.
backup_argv = sys.argv[:]
sys.argv[1:] = args
try:
# run_module() alters sys.modules and sys.argv, but restores them at exit
runpy.run_module("pip", run_name="__main__", alter_sys=True)
except SystemExit as exc:
return exc.code
finally:
sys.argv[:] = backup_argv

raise SystemError("pip did not exit, this should never happen")
# 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
# the files in *additional_paths*, preventing us to remove them at the end of the
# invocation.
code = f"""
import runpy
import sys
< 7154 /td> 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, "-c", code], check=True).returncode


def version():
Expand Down
Binary file not shown.
0