Skip to content

Commit 7a2a143

Browse files
committed
remove should_build_for_wheel_command
In pip wheel, we always want wheels, of course. should_build_for_wheel_command was only called when is_wheel is False, so the logging statement part of _should_build was never reached. Since this is the only side effect and _should_build otherwise always return true in these circumstances, it can be removed.
1 parent 910a712 commit 7a2a143

File tree

3 files changed

+2
-26
lines changed

3 files changed

+2
-26
lines changed

src/pip/_internal/commands/wheel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
)
1717
from pip._internal.utils.misc import ensure_dir, normalize_path
1818
from pip._internal.utils.temp_dir import TempDirectory
19-
from pip._internal.wheel_builder import build, should_build_for_wheel_command
19+
from pip._internal.wheel_builder import build
2020

2121
logger = logging.getLogger(__name__)
2222

@@ -150,7 +150,7 @@ def run(self, options: Values, args: List[str]) -> int:
150150
for req in requirement_set.requirements.values():
151151
if req.is_wheel:
152152
preparer.save_linked_requirement(req)
153-
elif should_build_for_wheel_command(req):
153+
else:
154154
reqs_to_build.append(req)
155155

156156
preparer.prepare_linked_requirements_more(requirement_set.requirements.values())

src/pip/_internal/wheel_builder.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ def _should_build(
7373
return True
7474

7575

76-
def should_build_for_wheel_command(
77-
req: InstallRequirement,
78-
) -> bool:
79-
return _should_build(req, need_wheel=True)
80-
81-
8276
def should_build_for_install_command(
8377
req: InstallRequirement,
8478
) -> bool:

tests/unit/test_wheel_builder.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,6 @@ def test_should_build_for_install_command(req: ReqMock, expected: bool) -> None:
8484
assert should_build is expected
8585

8686

87-
@pytest.mark.parametrize(
88-
"req, expected",
89-
[
90-
(ReqMock(), True),
91-
(ReqMock(is_wheel=True), False),
92-
(ReqMock(editable=True, use_pep517=False), True),
93-
(ReqMock(editable=True, use_pep517=True), True),
94-
(ReqMock(source_dir=None), True),
95-
(ReqMock(link=Link("git+https://g.c/org/repo")), True),
96-
],
97-
)
98-
def test_should_build_for_wheel_command(req: ReqMock, expected: bool) -> None:
99-
should_build = wheel_builder.should_build_for_wheel_command(
100-
cast(InstallRequirement, req)
101-
)
102-
assert should_build is expected
103-
104-
10587
@pytest.mark.parametrize(
10688
"req, expected",
10789
[

0 commit comments

Comments
 (0)