@@ -165,12 +165,6 @@ def unpack_http_url(
165
165
# downloading archives, they have to be unpacked to parse dependencies
166
166
unpack_file (from_path , location , content_type )
167
167
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
-
174
168
return from_path
175
169
176
170
@@ -223,9 +217,6 @@ def unpack_file_url(
223
217
):
224
218
# type: (...) -> Optional[str]
225
219
"""Unpack link into location.
226
-
227
- If download_dir is provided and link points to a file, make a copy
228
- of the link file inside download_dir.
229
220
"""
230
221
link_path = link .file_path
231
222
# If it's a url to a local directory
@@ -261,12 +252,6 @@ def unpack_file_url(
261
252
# archives, they have to be unpacked to parse dependencies
262
253
unpack_file (from_path , location , content_type )
263
254
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
-
270
255
return from_path
271
256
272
257
@@ -278,14 +263,7 @@ def unpack_url(
278
263
hashes = None , # type: Optional[Hashes]
279
264
):
280
265
# type: (...) -> Optional[str]
281
- """Unpack link.
282
- If link is a VCS link:
283
- if only_download, export into download_dir and ignore location
284
- else unpack into location
285
- for other types of link:
286
- - unpack into location
287
- - if download_dir, copy the file into download_dir
288
- - if only_download, mark location for deletion
266
+ """Unpack link into location, downloading if required.
289
267
290
268
:param hashes: A Hashes object, one of whose embedded hashes must match,
291
269
or HashMismatch will be raised. If the Hashes is empty, no matches are
@@ -545,6 +523,10 @@ def prepare_linked_requirement(
545
523
if download_dir :
546
524
if link .is_existing_dir ():
547
525
logger .info ('Link is a directory, ignoring download_dir' )
526
+ elif local_path and not os .path .exists (
527
+ os .path .join (download_dir , link .filename )
528
+ ):
529
+ _copy_file (local_path , download_dir , link )
548
530
549
531
if self ._download_should_save :
550
532
# Make a .zip of the source_dir we already created.
0 commit comments