5
5
import os .path
6
6
import re
7
7
import shutil
8
- from typing import Any , Callable , Iterable , List , Optional , Tuple
8
+ from typing import Callable , Iterable , List , Optional , Tuple
9
9
10
10
from pip ._vendor .packaging .utils import canonicalize_name , canonicalize_version
11
11
from pip ._vendor .packaging .version import InvalidVersion , Version
@@ -47,7 +47,7 @@ def _contains_egg_info(s: str) -> bool:
47
47
def _should_build (
48
48
req : InstallRequirement ,
49
49
need_wheel : bool ,
50
- check_binary_allowed : BinaryAllowedPredicate ,
50
+ check_binary_allowed : Optional [ BinaryAllowedPredicate ] = None ,
51
51
) -> bool :
52
52
"""Return whether an InstallRequirement should be built into a wheel."""
53
53
if req .constraint :
@@ -78,6 +78,7 @@ def _should_build(
78
78
if req .use_pep517 :
79
79
return True
80
80
81
+ assert check_binary_allowed is not None
81
82
if not check_binary_allowed (req ):
82
83
logger .info (
83
84
"Skipping wheel build for %s, due to binaries being disabled for it." ,
@@ -96,7 +97,7 @@ def _should_build(
96
97
def should_build_for_wheel_command (
97
98
req : InstallRequirement ,
98
99
) -> bool :
99
- return _should_build (req , need_wheel = True , check_binary_allowed = _always_true )
100
+ return _should_build (req , need_wheel = True )
100
101
101
102
102
103
def should_build_for_install_command (
@@ -156,10 +157,6 @@ def _get_cache_dir(
156
157
return cache_dir
157
158
158
159
159
- def _always_true (_ : Any ) -> bool :
160
- return True
161
-
162
-
163
160
def _verify_one (req : InstallRequirement , wheel_path : str ) -> None :
164
161
canonical_name = canonicalize_name (req .name or "" )
165
162
w = Wheel (os .path .basename (wheel_path ))
0 commit comments