Skip to content

Commit 61cc712

Browse files
author
Noah Gorny
committed
cache: Do not raise error when there are no files to remove
Instead log a warning and continue (to log that we removed 0 files)
1 parent 48dc9f4 commit 61cc712

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

news/10459.feature.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Do not raise error when there are no files to remove with ``pip cache purge/remove``.
2+
Instead log a warning and continue (to log that we removed 0 files).

src/pip/_internal/commands/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def remove_cache_items(self, options: Values, args: List[Any]) -> None:
175175
files += self._find_http_files(options)
176176

177177
if not files:
178-
raise CommandError("No matching packages")
178+
logger.warning("No matching packages")
179179

180180
for filename in files:
181181
os.unlink(filename)

0 commit comments

Comments
 (0)