Skip to content

Commit df8a501

Browse files
committed
Simplify should_build
1 parent 08087ba commit df8a501

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/pip/_internal/wheel_builder.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os.path
66
import re
77
import shutil
8-
from typing import Any, Callable, Iterable, List, Optional, Tuple
8+
from typing import Callable, Iterable, List, Optional, Tuple
99

1010
from pip._vendor.packaging.utils import canonicalize_name, canonicalize_version
1111
from pip._vendor.packaging.version import InvalidVersion, Version
@@ -47,7 +47,7 @@ def _contains_egg_info(s: str) -> bool:
4747
def _should_build(
4848
req: InstallRequirement,
4949
need_wheel: bool,
50-
check_binary_allowed: BinaryAllowedPredicate,
50+
check_binary_allowed: Optional[BinaryAllowedPredicate] = None,
5151
) -> bool:
5252
"""Return whether an InstallRequirement should be built into a wheel."""
5353
if req.constraint:
@@ -78,6 +78,7 @@ def _should_build(
7878
if req.use_pep517:
7979
return True
8080

81+
assert check_binary_allowed is not None
8182
if not check_binary_allowed(req):
8283
logger.info(
8384
"Skipping wheel build for %s, due to binaries being disabled for it.",
@@ -96,7 +97,7 @@ def _should_build(
9697
def should_build_for_wheel_command(
9798
req: InstallRequirement,
9899
) -> bool:
99-
return _should_build(req, need_wheel=True, check_binary_allowed=_always_true)
100+
return _should_build(req, need_wheel=True)
100101

101102

102103
def should_build_for_install_command(
@@ -156,10 +157,6 @@ def _get_cache_dir(
156157
return cache_dir
157158

158159

159-
def _always_true(_: Any) -> bool:
160-
return True
161-
162-
163160
def _verify_one(req: InstallRequirement, wheel_path: str) -> None:
164161
canonical_name = canonicalize_name(req.name or "")
165162
w = Wheel(os.path.basename(wheel_path))

0 commit comments

Comments
 (0)