Skip to content

Commit 763a344

Browse files
author
Noah Gorny
committed
install: Update extra-index-url in session from requirements file
1 parent 4645ecb commit 763a344

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/pip/_internal/commands/install.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ def run(self, options, args):
296296

297297
try:
298298
reqs = self.get_requirements(args, options, finder, session)
299+
# We need to update the auth urls in session
300+
session.update_index_urls(finder.index_urls)
299301

300302
warn_deprecated_install_options(
301303
reqs, options.install_options

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
"""

0 commit comments

Comments
 (0)