Skip to content

Commit b9bdad2

Browse files
authored
Do not depend on cached download for copying downloaded file (#7474)
2 parents b44c217 + 7dea92e commit b9bdad2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/pip/_internal/operations/prepare.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ def unpack_http_url(
166166
unpack_file(from_path, location, content_type)
167167

168168
# a download dir is specified; let's copy the archive there
169-
if download_dir and not already_downloaded_path:
169+
if download_dir and not os.path.exists(
170+
os.path.join(download_dir, link.filename)
171+
):
170172
_copy_file(from_path, download_dir, link)
171173

172174

@@ -260,7 +262,9 @@ def unpack_file_url(
260262
unpack_file(from_path, location, content_type)
261263

262264
# a download dir is specified and not already downloaded
263-
if download_dir and not already_downloaded_path:
265+
if download_dir and not os.path.exists(
266+
os.path.join(download_dir, link.filename)
267+
):
264268
_copy_file(from_path, download_dir, link)
265269

266270

0 commit comments

Comments
 (0)