Skip to content

Commit

Permalink
Replace already_downloaded_path with existence check
Browse files Browse the repository at this point in the history
These statements are equivalent, so we exchange them. This will make it
easier to factor the download_dir concerns out of these functions.
  • Loading branch information
chrahunt committed Dec 13, 2019
1 parent d9ac3c4 commit 6e12a9d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ def unpack_http_url(
unpack_file(from_path, location, content_type)

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


Expand Down Expand Up @@ -237,8 +236,9 @@ def unpack_file_url(
unpack_file(from_path, location, content_type)

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


Expand Down

0 comments on commit 6e12a9d

Please sign in to comment.