Skip to content

Commit 910a712

Browse files
committed
_should_build is never called for constraints
The only call sites are in pip install in pip wheel, after resolution, so there are never constraint requirements there.
1 parent e930fee commit 910a712

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/pip/_internal/wheel_builder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ def _should_build(
4646
need_wheel: bool,
4747
) -> bool:
4848
"""Return whether an InstallRequirement should be built into a wheel."""
49-
if req.constraint:
50-
# never build requirements that are merely constraints
51-
return False
49+
assert not req.constraint
50+
5251
if req.is_wheel:
5352
if need_wheel:
5453
logger.info(

tests/unit/test_wheel_builder.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ class ReqMock:
5151
# We build, whether pep 517 is enabled or not.
5252
(ReqMock(use_pep517=True), True),
5353
(ReqMock(use_pep517=False), True),
54-
# We don't build constraints.
55-
(ReqMock(constraint=True), False),
5654
# We don't build reqs that are already wheels.
5755
(ReqMock(is_wheel=True), False),
5856
# We build editables if the backend supports PEP 660.
@@ -90,7 +88,6 @@ def test_should_build_for_install_command(req: ReqMock, expected: bool) -> None:
9088
"req, expected",
9189
[
9290
(ReqMock(), True),
93-
(ReqMock(constraint=True), False),
9491
(ReqMock(is_wheel=True), False),
9592
(ReqMock(editable=True, use_pep517=False), True),
9693
(ReqMock(editable=True, use_pep517=True), True),

0 commit comments

Comments
 (0)