Skip to content

Commit

Permalink
commands: cache: Abort early if cache is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Gorny committed Apr 24, 2020
1 parent daff811 commit e212f66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/8124.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Abort pip cache commands early when cache is disabled.
5 changes: 5 additions & 0 deletions src/pip/_internal/commands/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ def run(self, options, args):
"purge": self.purge_cache,
}

if not options.cache_dir:
logger.error("pip cache commands can not "
"function since cache is disabled.")
return ERROR

# Determine action
if not args or args[0] not in handlers:
logger.error("Need an action ({}) to perform.".format(
Expand Down

0 comments on commit e212f66

Please sign in to comment.