Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate --build-dir #8372

Merged
merged 1 commit into from
Jun 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions news/8372.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Deprecate -b/--build/--build-dir/--build-directory. Its current behaviour is confusing
and breaks in case different versions of the same distribution need to be built during
the resolution process. Using the TMPDIR/TEMP/TMP environment variable, possibly
combined with --no-clean covers known use cases.
14 changes: 14 additions & 0 deletions src/pip/_internal/cli/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,20 @@ def _main(self, args):
)
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,
)

try:
status = self.run(options, args)
assert isinstance(status, int)
Expand Down
3 changes: 2 additions & 1 deletion src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,8 @@ def _handle_build_dir(option, opt, value, parser):
metavar='dir',
action='callback',
callback=_handle_build_dir,
help='Directory to unpack packages into and build in. Note that '
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. '
Expand Down
6 changes: 5 additions & 1 deletion tests/functional/test_install_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ def test_no_clean_option_blocks_cleaning_after_install(script, data):
build = script.base_path / 'pip-build'
script.pip(
'install', '--no-clean', '--no-index', '--build', build,
'--find-links={}'.format(data.find_links), 'simple', expect_temp=True,
'--find-links={}'.format(data.find_links), 'simple',
expect_temp=True,
# TODO: allow_stderr_warning is used for the --build deprecation,
# remove it when removing support for --build
allow_stderr_warning=True,
)
assert exists(build)

Expand Down
3 changes: 3 additions & 0 deletions tests/functional/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ def test_no_clean_option_blocks_cleaning_after_wheel(script, data):
'--find-links={data.find_links}'.format(**locals()),
'simple',
expect_temp=True,
# TODO: allow_stderr_warning is used for the --build deprecation,
# remove it when removing support for --build
allow_stderr_warning=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment saying "remove allow_stderr_warning, which is used for the --build deprecation"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, in this case I think a comment is enough because this test will have to be revisited anyway when --build is removed.

)
build = build / 'simple'
assert exists(build), \
Expand Down