From 40904e3a058e5aca33f7103bd7769b98242c18fa Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Sun, 25 Oct 2020 10:35:38 +0000 Subject: [PATCH] Remove --build-dir option, as per deprecation --- src/pip/_internal/cli/base_command.py | 14 -------------- src/pip/_internal/cli/cmdoptions.py | 23 ----------------------- src/pip/_internal/commands/download.py | 5 +---- src/pip/_internal/commands/install.py | 6 +----- src/pip/_internal/commands/wheel.py | 5 +---- src/pip/_internal/req/req_install.py | 4 ++++ src/pip/_internal/utils/temp_dir.py | 2 ++ 7 files changed, 9 insertions(+), 50 deletions(-) diff --git a/src/pip/_internal/cli/base_command.py b/src/pip/_internal/cli/base_command.py index e4b07e0ce..f4f86e0e0 100644 --- a/src/pip/_internal/cli/base_command.py +++ b/src/pip/_internal/cli/base_command.py @@ -197,20 +197,6 @@ class Command(CommandContextMixIn): ) options.cache_dir = None - if getattr(options, "build_dir", None): - deprecated( - reason=( - "The -b/--build/--build-dir/--build-directory " - "option is deprecated." - ), - replacement=( - "use the TMPDIR/TEMP/TMP environment variable, " - "possibly combined with --no-clean" - ), - gone_in="20.3", - issue=8333, - ) - if 'resolver' in options.unstable_features: logger.critical( "--unstable-feature=resolver is no longer supported, and " diff --git a/src/pip/_internal/cli/cmdoptions.py b/src/pip/_internal/cli/cmdoptions.py index 2f640b2cb..e96eac586 100644 --- a/src/pip/_internal/cli/cmdoptions.py +++ b/src/pip/_internal/cli/cmdoptions.py @@ -685,29 +685,6 @@ no_deps = partial( ) # type: Callable[..., Option] -def _handle_build_dir(option, opt, value, parser): - # type: (Option, str, str, OptionParser) -> None - if value: - value = os.path.abspath(value) - setattr(parser.values, option.dest, value) - - -build_dir = partial( - PipOption, - '-b', '--build', '--build-dir', '--build-directory', - dest='build_dir', - type='path', - metavar='dir', - action='callback', - callback=_handle_build_dir, - help='(DEPRECATED) ' - 'Directory to unpack packages into and build in. Note that ' - 'an initial build still takes place in a temporary directory. ' - 'The location of temporary directories can be controlled by setting ' - 'the TMPDIR environment variable (TEMP on Windows) appropriately. ' - 'When passed, build directories are not cleaned in case of failures.' -) # type: Callable[..., Option] - ignore_requires_python = partial( Option, '--ignore-requires-python', diff --git a/src/pip/_internal/commands/download.py b/src/pip/_internal/commands/download.py index 2f151e049..9535ef3cb 100644 --- a/src/pip/_internal/commands/download.py +++ b/src/pip/_internal/commands/download.py @@ -43,7 +43,6 @@ class DownloadCommand(RequirementCommand): # type: () -> None self.cmd_opts.add_option(cmdoptions.constraints()) self.cmd_opts.add_option(cmdoptions.requirements()) - self.cmd_opts.add_option(cmdoptions.build_dir()) self.cmd_opts.add_option(cmdoptions.no_deps()) self.cmd_opts.add_option(cmdoptions.global_options()) self.cmd_opts.add_option(cmdoptions.no_binary()) @@ -97,13 +96,11 @@ class DownloadCommand(RequirementCommand): session=session, target_python=target_python, ) - build_delete = (not (options.no_clean or options.build_dir)) req_tracker = self.enter_context(get_requirement_tracker()) directory = TempDirectory( - options.build_dir, - delete=build_delete, + delete=not options.no_clean, kind="download", globally_managed=True, ) diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index e41660070..a4001553b 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -129,8 +129,6 @@ class InstallCommand(RequirementCommand): help="Installation prefix where lib, bin and other top-level " "folders are placed") - self.cmd_opts.add_option(cmdoptions.build_dir()) - self.cmd_opts.add_option(cmdoptions.src()) self.cmd_opts.add_option( @@ -277,14 +275,12 @@ class InstallCommand(RequirementCommand): target_python=target_python, ignore_requires_python=options.ignore_requires_python, ) - build_delete = (not (options.no_clean or options.build_dir)) wheel_cache = WheelCache(options.cache_dir, options.format_control) req_tracker = self.enter_context(get_requirement_tracker()) directory = TempDirectory( - options.build_dir, - delete=build_delete, + delete=not options.no_clean, kind="install", globally_managed=True, ) diff --git a/src/pip/_internal/commands/wheel.py b/src/pip/_internal/commands/wheel.py index 8f5783c35..2d654338d 100644 --- a/src/pip/_internal/commands/wheel.py +++ b/src/pip/_internal/commands/wheel.py @@ -78,7 +78,6 @@ class WheelCommand(RequirementCommand): self.cmd_opts.add_option(cmdoptions.src()) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option(cmdoptions.no_deps()) - self.cmd_opts.add_option(cmdoptions.build_dir()) self.cmd_opts.add_option(cmdoptions.progress_bar()) self.cmd_opts.add_option( @@ -115,7 +114,6 @@ class WheelCommand(RequirementCommand): session = self.get_default_session(options) finder = self._build_package_finder(options, session) - 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) @@ -124,8 +122,7 @@ class WheelCommand(RequirementCommand): req_tracker = self.enter_context(get_requirement_tracker()) directory = TempDirectory( - options.build_dir, - delete=build_delete, + delete=not options.no_clean, kind="wheel", globally_managed=True, ) diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index 8ce299503..866d18fcb 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -358,6 +358,10 @@ class InstallRequirement(object): return self._temp_build_dir.path + # This is the only remaining place where we manually determine the path + # for the temporary directory. It is only needed for editables where + # it is the value of the --src option. + # When parallel builds are enabled, add a UUID to the build directory # name so multiple builds do not interfere with each other. dir_name = canonicalize_name(self.name) diff --git a/src/pip/_internal/utils/temp_dir.py b/src/pip/_internal/utils/temp_dir.py index 03aa82866..220a093e2 100644 --- a/src/pip/_internal/utils/temp_dir.py +++ b/src/pip/_internal/utils/temp_dir.py @@ -134,6 +134,8 @@ class TempDirectory(object): # tempdir_registry says. delete = None + # The only time we specify path is in for editables where it + # is the value of the --src option. if path is None: path = self._create(kind)