Skip to content

Commit 3c1a641

Browse files
author
Noah Gorny
committed
reqfile: Update extra-index-url/index-url in session from requirements file
1 parent 3d3c7b6 commit 3c1a641

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/pip/_internal/network/session.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,14 @@ def __init__(self, *args, **kwargs):
305305
for host in trusted_hosts:
306306
self.add_trusted_host(host, suppress_logging=True)
307307

308+
def update_index_urls(self, new_index_urls):
309+
# type: (List[str]) -> None
310+
"""
311+
:param new_index_urls: New index urls to update the authentication
312+
handler with.
313+
"""
314+
self.auth.index_urls = new_index_urls
315+
308316
def add_trusted_host(self, host, source=None, suppress_logging=False):
309317
# type: (str, Optional[str], bool) -> None
310318
"""

src/pip/_internal/req/req_file.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ def handle_option_line(
256256
value = relative_to_reqs_file
257257
find_links.append(value)
258258

259+
if session:
260+
# We need to update the auth urls in session
261+
session.update_index_urls(index_urls)
262+
259263
search_scope = SearchScope(
260264
find_links=find_links,
261265
index_urls=index_urls,

0 commit comments

Comments
 (0)