Skip to content
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

Pass --proxy Option To Build Environment #13075

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions news/6018.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pass in command-line ``--proxy`` option to isolated build environment.
2 changes: 2 additions & 0 deletions src/pip/_internal/build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ def _install_requirements(
args.append("--pre")
if finder.prefer_binary:
args.append("--prefer-binary")
if finder.proxy is not None:
args.extend(["--proxy", finder.proxy])
args.append("--")
args.extend(requirements)
extra_environ = {"_PIP_STANDALONE_CERT": where()}
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,5 @@ def _build_package_finder(
link_collector=link_collector,
selection_prefs=selection_prefs,
target_python=target_python,
proxy=options.proxy,
)
6 changes: 6 additions & 0 deletions src/pip/_internal/index/package_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ def __init__(
format_control: Optional[FormatControl] = None,
candidate_prefs: Optional[CandidatePreferences] = None,
ignore_requires_python: Optional[bool] = None,
proxy: Optional[str] = None,
) -> None:
"""
This constructor is primarily meant to be used by the create() class
Expand Down Expand Up @@ -619,6 +620,9 @@ def __init__(
# These are boring links that have already been logged somehow.
self._logged_links: Set[Tuple[Link, LinkType, str]] = set()

# Send in proxy for build environment
self.proxy = proxy

# Don't include an allow_yanked default value to make sure each call
# site considers whether yanked releases are allowed. This also causes
# that decision to be made explicit in the calling code, which helps
Expand All @@ -629,6 +633,7 @@ def create(
link_collector: LinkCollector,
selection_prefs: SelectionPreferences,
target_python: Optional[TargetPython] = None,
proxy: Optional[str] = None,
) -> "PackageFinder":
"""Create a PackageFinder.

Expand All @@ -653,6 +658,7 @@ def create(
allow_yanked=selection_prefs.allow_yanked,
format_control=selection_prefs.format_control,
ignore_requires_python=selection_prefs.ignore_requires_python,
proxy=proxy,
)

@property
Expand Down
Loading