@@ -143,7 +143,7 @@ def unpack_http_url(
143143 download_dir = None , # type: Optional[str]
144144 hashes = None , # type: Optional[Hashes]
145145):
146- # type: (...) -> None
146+ # type: (...) -> str
147147 temp_dir = TempDirectory (kind = "unpack" , globally_managed = True )
148148 # If a download dir is specified, is the file already downloaded there?
149149 already_downloaded_path = None
@@ -171,6 +171,8 @@ def unpack_http_url(
171171 ):
172172 _copy_file (from_path , download_dir , link )
173173
174+ return from_path
175+
174176
175177def _copy2_ignoring_special_files (src , dest ):
176178 # type: (str, str) -> None
@@ -219,7 +221,7 @@ def unpack_file_url(
219221 download_dir = None , # type: Optional[str]
220222 hashes = None # type: Optional[Hashes]
221223):
222- # type: (...) -> None
224+ # type: (...) -> Optional[str]
223225 """Unpack link into location.
224226
225227 If download_dir is provided and link points to a file, make a copy
@@ -233,7 +235,7 @@ def unpack_file_url(
233235 _copy_source_tree (link_path , location )
234236 if download_dir :
235237 logger .info ('Link is a directory, ignoring download_dir' )
236- return
238+ return None
237239
238240 # If --require-hashes is off, `hashes` is either empty, the
239241 # link's embedded hash, or MissingHashes; it is required to
@@ -267,6 +269,8 @@ def unpack_file_url(
267269 ):
268270 _copy_file (from_path , download_dir , link )
269271
272+ return from_path
273+
270274
271275def unpack_url (
272276 link , # type: Link
@@ -275,7 +279,7 @@ def unpack_url(
275279 download_dir = None , # type: Optional[str]
276280 hashes = None , # type: Optional[Hashes]
277281):
278- # type: (...) -> None
282+ # type: (...) -> Optional[str]
279283 """Unpack link.
280284 If link is a VCS link:
281285 if only_download, export into download_dir and ignore location
@@ -293,14 +297,15 @@ def unpack_url(
293297 # non-editable vcs urls
294298 if link .is_vcs :
295299 unpack_vcs_link (link , location )
300+ return None
296301
297302 # file urls
298303 elif link .is_file :
299- unpack_file_url (link , location , download_dir , hashes = hashes )
304+ return unpack_file_url (link , location , download_dir , hashes = hashes )
300305
301306 # http urls
302307 else :
303- unpack_http_url (
308+ return unpack_http_url (
304309 link ,
305310 location ,
306311 downloader ,
@@ -500,7 +505,7 @@ def prepare_linked_requirement(
500505 download_dir = self .wheel_download_dir
501506
502507 try :
503- unpack_url (
508+ local_path = unpack_url (
504509 link , req .source_dir , self .downloader , download_dir ,
505510 hashes = hashes ,
506511 )
@@ -515,6 +520,11 @@ def prepare_linked_requirement(
515520 'error {} for URL {}' .format (req , exc , link )
516521 )
517522
523+ # For use in later processing, preserve the file path on the
524+ # requirement.
525+ if local_path :
526+ req .local_file_path = local_path
527+
518528 if link .is_wheel :
519529 if download_dir :
520530 # When downloading, we only unpack wheels to get
0 commit comments