Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
_service/pypi.py: Do not execute pip cache cmd if custom dir is given
In a scenario where the pip cache directory isn't available because the user doesn't have permissions, pip will error with this message: ``` ERROR: pip cache commands can not function since cache is disabled. ``` This currently cannot be mitigated by specifying the `--cache-dir` flag because the `python -m pip cache dir` command is execute before this predicate is evaluated. By using an assignment expression (PEP 572), we can evaluate whether the expression evaluates to a truthy value in the `elif` branch (saving it's return value) AFTER first evaluating the custom directory value.
- Loading branch information