1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Disable pip's version check for commands that do not touch the index

This commit is contained in:
Pradyun Gedam 2018-09-05 23:20:08 +05:30
parent 0d9c05ec32
commit 885a000775
No known key found for this signature in database
GPG key ID: DA17C4B29CB32E4B
2 changed files with 9 additions and 5 deletions

2
news/5433.bugfix Normal file
View file

@ -0,0 +1,2 @@
Run self-version-check only on commands that may access the index, instead of
trying on every run and failing to do so due to missing options.

View file

@ -170,12 +170,14 @@ class Command(object):
return UNKNOWN_ERROR
finally:
# Check if we're using the latest version of pip available
skip_version_check = (
options.disable_pip_version_check or
getattr(options, "no_index", False)
allow_version_check = (
# Does this command have the index_group options?
hasattr(options, "no_index") and
# Is this command allowed to perform this check?
not (options.disable_pip_version_check or options.no_index)
)
if not skip_version_check:
# Check if we're using the latest version of pip available
if allow_version_check:
session = self._build_session(
options,
retries=0,