Skip to content

Commit b479622

Browse files
committed
Move Downloader out of unpack_url
This simplifies the work done in the operations.prepare helper functions and also opens up the door to remove session and progress_bar from RequirementPreparer itself.
1 parent f663b39 commit b479622

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/pip/_internal/operations/prepare.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,9 @@ def unpack_file_url(
331331
def unpack_url(
332332
link, # type: Link
333333
location, # type: str
334-
session, # type: PipSession
334+
downloader, # type: Downloader
335335
download_dir=None, # type: Optional[str]
336336
hashes=None, # type: Optional[Hashes]
337-
progress_bar="on" # type: str
338337
):
339338
# type: (...) -> None
340339
"""Unpack link.
@@ -361,8 +360,6 @@ def unpack_url(
361360

362361
# http urls
363362
else:
364-
downloader = Downloader(session, progress_bar)
365-
366363
unpack_http_url(
367364
link,
368365
location,
@@ -686,11 +683,12 @@ def prepare_linked_requirement(
686683
# dedicated dir.
687684
download_dir = self.wheel_download_dir
688685

686+
downloader = Downloader(self.session, self.progress_bar)
687+
689688
try:
690689
unpack_url(
691-
link, req.source_dir, self.session, download_dir,
690+
link, req.source_dir, downloader, download_dir,
692691
hashes=hashes,
693-
progress_bar=self.progress_bar
694692
)
695693
except requests.HTTPError as exc:
696694
logger.critical(

0 commit comments

Comments
 (0)