From 78b294e7461c0df200b894a54362681c7e994815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Fri, 4 Sep 2020 16:20:13 +0700 Subject: [PATCH] Remove download_dir exist check Both pip download and wheel call endure_dir on the directory. --- src/pip/_internal/commands/download.py | 1 - src/pip/_internal/operations/prepare.py | 18 ++---------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/pip/_internal/commands/download.py b/src/pip/_internal/commands/download.py index 0861d9e67..31eebd962 100644 --- a/src/pip/_internal/commands/download.py +++ b/src/pip/_internal/commands/download.py @@ -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) diff --git a/src/pip/_internal/operations/prepare.py b/src/pip/_internal/operations/prepare.py index 3060bafa1..c48bcca63 100644 --- a/src/pip/_internal/operations/prepare.py +++ b/src/pip/_internal/operations/prepare.py @@ -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