mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Move directory handling from unpack_file_url to unpack_url
This commit is contained in:
parent
395787bebc
commit
791725aad9
1 changed files with 8 additions and 8 deletions
|
@ -213,16 +213,9 @@ def unpack_file_url(
|
|||
download_dir=None, # type: Optional[str]
|
||||
hashes=None # type: Optional[Hashes]
|
||||
):
|
||||
# type: (...) -> Optional[str]
|
||||
# type: (...) -> str
|
||||
"""Unpack link into location.
|
||||
"""
|
||||
# If it's a url to a local directory
|
||||
if link.is_existing_dir():
|
||||
if os.path.isdir(location):
|
||||
rmtree(location)
|
||||
_copy_source_tree(link.file_path, location)
|
||||
return None
|
||||
|
||||
# If a download dir is specified, is the file already there and valid?
|
||||
already_downloaded_path = None
|
||||
if download_dir:
|
||||
|
@ -272,6 +265,13 @@ def unpack_url(
|
|||
unpack_vcs_link(link, location)
|
||||
return None
|
||||
|
||||
# If it's a url to a local directory
|
||||
if link.is_existing_dir():
|
||||
if os.path.isdir(location):
|
||||
rmtree(location)
|
||||
_copy_source_tree(link.file_path, location)
|
||||
return None
|
||||
|
||||
# file urls
|
||||
if link.is_file:
|
||||
return unpack_file_url(link, location, download_dir, hashes=hashes)
|
||||
|
|
Loading…
Reference in a new issue