Skip to content

Commit acab2ee

Browse files
sbidoulxavfernandez
authored andcommitted
Deprecate --build-dir
1 parent 3a3d1d5 commit acab2ee

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

news/8372.removal

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Deprecate -b/--build/--build-dir/--build-directory. Its current behaviour is confusing
2+
and breaks in case different versions of the same distribution need to be built during
3+
the resolution process. Using the TMPDIR/TEMP/TMP environment variable, possibly
4+
combined with --no-clean covers known use cases.

src/pip/_internal/cli/base_command.py

+14
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,20 @@ def _main(self, args):
190190
)
191191
options.cache_dir = None
192192

193+
if getattr(options, "build_dir", None):
194+
deprecated(
195+
reason=(
196+
"The -b/--build/--build-dir/--build-directory "
197+
"option is deprecated."
198+
),
199+
replacement=(
200+
"use the TMPDIR/TEMP/TMP environment variable, "
201+
"possibly combined with --no-clean"
202+
),
203+
gone_in="20.3",
204+
issue=8333,
205+
)
206+
193207
try:
194208
status = self.run(options, args)
195209
assert isinstance(status, int)

src/pip/_internal/cli/cmdoptions.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,8 @@ def _handle_build_dir(option, opt, value, parser):
702702
metavar='dir',
703703
action='callback',
704704
callback=_handle_build_dir,
705-
help='Directory to unpack packages into and build in. Note that '
705+
help='(DEPRECATED) '
706+
'Directory to unpack packages into and build in. Note that '
706707
'an initial build still takes place in a temporary directory. '
707708
'The location of temporary directories can be controlled by setting '
708709
'the TMPDIR environment variable (TEMP on Windows) appropriately. '

tests/functional/test_install_cleanup.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ def test_no_clean_option_blocks_cleaning_after_install(script, data):
1414
build = script.base_path / 'pip-build'
1515
script.pip(
1616
'install', '--no-clean', '--no-index', '--build', build,
17-
'--find-links={}'.format(data.find_links), 'simple', expect_temp=True,
17+
'--find-links={}'.format(data.find_links), 'simple',
18+
expect_temp=True,
19+
# TODO: allow_stderr_warning is used for the --build deprecation,
20+
# remove it when removing support for --build
21+
allow_stderr_warning=True,
1822
)
1923
assert exists(build)
2024

tests/functional/test_wheel.py

+3
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ def test_no_clean_option_blocks_cleaning_after_wheel(
201201
'--find-links={data.find_links}'.format(**locals()),
202202
'simple',
203203
expect_temp=True,
204+
# TODO: allow_stderr_warning is used for the --build deprecation,
205+
# remove it when removing support for --build
206+
allow_stderr_warning=True,
204207
)
205208

206209
if not use_new_resolver:

0 commit comments

Comments
 (0)