Remove download_dir exist check

Both pip download and wheel call endure_dir on the directory.
This commit is contained in:
Nguyễn Gia Phong 2020-09-04 16:20:13 +07:00
parent dcc12f3786
commit 78b294e746
2 changed files with 2 additions and 17 deletions

View File

@ -87,7 +87,6 @@ class DownloadCommand(RequirementCommand):
cmdoptions.check_dist_restriction(options)
options.download_dir = normalize_path(options.download_dir)
ensure_dir(options.download_dir)
session = self.get_default_session(options)

View File

@ -353,20 +353,6 @@ class RequirementPreparer(object):
# Previous "header" printed for a link-based InstallRequirement
self._previous_requirement_header = ("", "")
@property
def _download_should_save(self):
# type: () -> bool
if not self.download_dir:
return False
if os.path.exists(self.download_dir):
return True
logger.critical('Could not find download directory')
raise InstallationError(
"Could not find or access download directory '{}'"
.format(self.download_dir))
def _log_preparing_link(self, req):
# type: (InstallRequirement) -> None
"""Provide context for the requirement being prepared."""
@ -568,9 +554,9 @@ class RequirementPreparer(object):
download_path = display_path(download_location)
logger.info('Saved %s', download_path)
if self._download_should_save:
if link.is_vcs:
# Make a .zip of the source_dir we already created.
if link.is_vcs:
if self.download_dir is not None:
req.archive(self.download_dir)
return dist