29
29
from pip ._internal .req import install_given_reqs
30
30
from pip ._internal .req .req_install import InstallRequirement
31
31
from pip ._internal .utils .compat import WINDOWS
32
- from pip ._internal .utils .deprecation import LegacyInstallReasonFailedBdistWheel
32
+ from pip ._internal .utils .deprecation import (
33
+ LegacyInstallReasonFailedBdistWheel ,
34
+ deprecated ,
35
+ )
33
36
from pip ._internal .utils .distutils_args import parse_distutils_args
34
37
from pip ._internal .utils .filesystem import test_writable_dir
35
38
from pip ._internal .utils .logging import getLogger
@@ -326,8 +329,6 @@ def run(self, options: Values, args: List[str]) -> int:
326
329
target_python = target_python ,
327
330
ignore_requires_python = options .ignore_requires_python ,
328
331
)
329
- wheel_cache = WheelCache (options .cache_dir , options .format_control )
330
-
331
332
build_tracker = self .enter_context (get_build_tracker ())
332
333
333
334
directory = TempDirectory (
@@ -339,6 +340,25 @@ def run(self, options: Values, args: List[str]) -> int:
339
340
try :
340
341
reqs = self .get_requirements (args , options , finder , session )
341
342
343
+ if "no-binary-enable-wheel-cache" in options .features_enabled :
344
+ # TODO: remove format_control from WheelCache when the deprecation cycle
345
+ # is over
346
+ wheel_cache = WheelCache (options .cache_dir )
347
+ else :
348
+ if options .format_control .no_binary :
349
+ deprecated (
350
+ reason = (
351
+ "--no-binary currently disables reading from "
352
+ "the cache of locally built wheels. In the future "
353
+ "--no-binary will not influence the wheel cache."
354
+ ),
355
+ replacement = "to use the --no-cache-dir option" ,
356
+ feature_flag = "no-binary-enable-wheel-cache" ,
357
+ issue = 11453 ,
358
+ gone_in = None ,
359
+ )
360
+ wheel_cache = WheelCache (options .cache_dir , options .format_control )
361
+
342
362
# Only when installing is it permitted to use PEP 660.
343
363
# In other circumstances (pip wheel, pip download) we generate
344
364
# regular (i.e. non editable) metadata and wheels.
0 commit comments