Skip to content

Commit

Permalink
Move download file copying out of unpacking functions
Browse files Browse the repository at this point in the history
Now our "unpacking" functions aren't also for sometimes populating
the download directory.
  • Loading branch information
chrahunt committed Dec 24, 2019
1 parent 5c90145 commit 5f725b6
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,6 @@ def unpack_http_url(
# downloading archives, they have to be unpacked to parse dependencies
unpack_file(from_path, location, content_type)

# a download dir is specified; let's copy the archive there
if download_dir and not os.path.exists(
os.path.join(download_dir, link.filename)
):
_copy_file(from_path, download_dir, link)

return from_path


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

# a download dir is specified and not already downloaded
if download_dir and not os.path.exists(
os.path.join(download_dir, link.filename)
):
_copy_file(from_path, download_dir, link)

return from_path


Expand Down Expand Up @@ -545,6 +533,10 @@ def prepare_linked_requirement(
if download_dir:
if link.is_existing_dir():
logger.info('Link is a directory, ignoring download_dir')
elif local_path and not os.path.exists(
os.path.join(download_dir, link.filename)
):
_copy_file(local_path, download_dir, link)

if self._download_should_save:
# Make a .zip of the source_dir we already created.
Expand Down

0 comments on commit 5f725b6

Please sign in to comment.