7
7
from pip ._vendor .packaging import version
8
8
from pip ._vendor import pkg_resources
9
9
from pip .basecommand import Command , SUCCESS
10
- from pip .exceptions import CommandError , InvalidWheelFilename
10
+ from pip .exceptions import InvalidWheelFilename
11
11
from pip .utils import ask , cached_property , canonicalize_name
12
12
from pip .wheel import Wheel
13
13
@@ -72,11 +72,11 @@ def __init__(self, *args, **kw):
72
72
super (CacheCommand , self ).__init__ (* args , ** kw )
73
73
74
74
self .cmd_opts .add_option (
75
- '--all ' ,
76
- dest = 'all_wheels ' ,
75
+ '--summary ' ,
76
+ dest = 'summary ' ,
77
77
action = 'store_true' ,
78
78
default = False ,
79
- help = 'Consider all wheels in cache ' )
79
+ help = 'Only print a summary ' )
80
80
self .cmd_opts .add_option (
81
81
'--remove' ,
82
82
dest = 'remove' ,
@@ -111,9 +111,6 @@ def run(self, options, args):
111
111
records .append (
112
112
WheelCacheRecord (os .path .join (dirpath , filename )))
113
113
114
- if options .all_wheels and args :
115
- raise CommandError ('You cannot pass args with --all option' )
116
-
117
114
if options .not_accessed_since :
118
115
# check if possible to have:
119
116
# --not-accessed-since and --not-accessed-since-days
@@ -138,8 +135,11 @@ def run(self, options, args):
138
135
record .remove ()
139
136
# Should we try to cleanup empty dirs and link files ?
140
137
else :
141
- if not args and not options .all_wheels :
142
- logger .info ('Found %s cached wheels' , len (records ))
138
+ if options .summary :
139
+ total_size = sum (record .size for record in records )
140
+ logger .info (
141
+ 'Found %s cached wheels for %s' ,
142
+ len (records ), human_readable_size (total_size ))
143
143
else :
144
144
log_results (records )
145
145
0 commit comments