Merge pull request #7524 from sbidoul/wheel-download-dir-sbi

Ensure wheel download dir is present at the beginning of wheel command
This commit is contained in:
Xavier Fernandez 2020-01-01 16:13:38 +01:00 committed by GitHub
commit 6896dfcd83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 14 deletions

View File

@ -15,7 +15,7 @@ from pip._internal.cli.req_command import RequirementCommand
from pip._internal.exceptions import CommandError, PreviousBuildDirError
from pip._internal.req import RequirementSet
from pip._internal.req.req_tracker import get_requirement_tracker
from pip._internal.utils.misc import ensure_dir
from pip._internal.utils.misc import ensure_dir, normalize_path
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.wheel_builder import WheelBuilder
@ -122,6 +122,9 @@ class WheelCommand(RequirementCommand):
build_delete = (not (options.no_clean or options.build_dir))
wheel_cache = WheelCache(options.cache_dir, options.format_control)
options.wheel_dir = normalize_path(options.wheel_dir)
ensure_dir(options.wheel_dir)
with get_requirement_tracker() as req_tracker, TempDirectory(
options.build_dir, delete=build_delete, kind="wheel"
) as directory:
@ -171,7 +174,6 @@ class WheelCommand(RequirementCommand):
assert req.local_file_path
# copy from cache to target directory
try:
ensure_dir(options.wheel_dir)
shutil.copy(req.local_file_path, options.wheel_dir)
except OSError as e:
logger.warning(

View File

@ -29,11 +29,7 @@ from pip._internal.exceptions import (
UnsupportedPythonVersion,
)
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
dist_in_usersite,
ensure_dir,
normalize_version_info,
)
from pip._internal.utils.misc import dist_in_usersite, normalize_version_info
from pip._internal.utils.packaging import (
check_requires_python,
get_requires_python,
@ -163,10 +159,6 @@ class Resolver(object):
possible to move the preparation to become a step separated from
dependency resolution.
"""
# make the wheelhouse
if self.preparer.wheel_download_dir:
ensure_dir(self.preparer.wheel_download_dir)
# If any top-level requirement has a hash specified, enter
# hash-checking mode, which requires hashes from all.
root_reqs = (

View File

@ -35,7 +35,6 @@ from pip._internal.utils.misc import (
backup_dir,
display_path,
hide_url,
normalize_path,
path_to_display,
rmtree,
)
@ -372,8 +371,6 @@ class RequirementPreparer(object):
# Where still-packed .whl files should be written to. If None, they are
# written to the download_dir parameter. Separate to download_dir to
# permit only keeping wheel archives for pip wheel.
if wheel_download_dir:
wheel_download_dir = normalize_path(wheel_download_dir)
self.wheel_download_dir = wheel_download_dir
# NOTE