Skip to content

Commit 5f725b6

Browse files
committed
Move download file copying out of unpacking functions
Now our "unpacking" functions aren't also for sometimes populating the download directory.
1 parent 5c90145 commit 5f725b6

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/pip/_internal/operations/prepare.py

+4-12
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,6 @@ def unpack_http_url(
165165
# downloading archives, they have to be unpacked to parse dependencies
166166
unpack_file(from_path, location, content_type)
167167

168-
# a download dir is specified; let's copy the archive there
169-
if download_dir and not os.path.exists(
170-
os.path.join(download_dir, link.filename)
171-
):
172-
_copy_file(from_path, download_dir, link)
173-
174168
return from_path
175169

176170

@@ -261,12 +255,6 @@ def unpack_file_url(
261255
# archives, they have to be unpacked to parse dependencies
262256
unpack_file(from_path, location, content_type)
263257

264-
# a download dir is specified and not already downloaded
265-
if download_dir and not os.path.exists(
266-
os.path.join(download_dir, link.filename)
267-
):
268-
_copy_file(from_path, download_dir, link)
269-
270258
return from_path
271259

272260

@@ -545,6 +533,10 @@ def prepare_linked_requirement(
545533
if download_dir:
546534
if link.is_existing_dir():
547535
logger.info('Link is a directory, ignoring download_dir')
536+
elif local_path and not os.path.exists(
537+
os.path.join(download_dir, link.filename)
538+
):
539+
_copy_file(local_path, download_dir, link)
548540

549541
if self._download_should_save:
550542
# Make a .zip of the source_dir we already created.

0 commit comments

Comments
 (0)