Skip to content

Commit 10698e4

Browse files
committed
remove --all and add --summary
1 parent e00387a commit 10698e4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pip/commands/cache.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pip._vendor.packaging import version
88
from pip._vendor import pkg_resources
99
from pip.basecommand import Command, SUCCESS
10-
from pip.exceptions import CommandError, InvalidWheelFilename
10+
from pip.exceptions import InvalidWheelFilename
1111
from pip.utils import ask, cached_property, canonicalize_name
1212
from pip.wheel import Wheel
1313

@@ -72,11 +72,11 @@ def __init__(self, *args, **kw):
7272
super(CacheCommand, self).__init__(*args, **kw)
7373

7474
self.cmd_opts.add_option(
75-
'--all',
76-
dest='all_wheels',
75+
'--summary',
76+
dest='summary',
7777
action='store_true',
7878
default=False,
79-
help='Consider all wheels in cache')
79+
help='Only print a summary')
8080
self.cmd_opts.add_option(
8181
'--remove',
8282
dest='remove',
@@ -111,9 +111,6 @@ def run(self, options, args):
111111
records.append(
112112
WheelCacheRecord(os.path.join(dirpath, filename)))
113113

114-
if options.all_wheels and args:
115-
raise CommandError('You cannot pass args with --all option')
116-
117114
if options.not_accessed_since:
118115
# check if possible to have:
119116
# --not-accessed-since and --not-accessed-since-days
@@ -138,8 +135,11 @@ def run(self, options, args):
138135
record.remove()
139136
# Should we try to cleanup empty dirs and link files ?
140137
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))
143143
else:
144144
log_results(records)
145145

0 commit comments

Comments
 (0)