mirror of https://github.com/pypa/pip
Use interpreter_name and _version in cache keys
This commit is contained in:
parent
824dca1060
commit
ab0593659d
|
@ -8,15 +8,14 @@ import hashlib
|
|||
import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from pip._vendor.packaging.utils import canonicalize_name
|
||||
|
||||
from pip._internal.exceptions import InvalidWheelFilename
|
||||
from pip._internal.models.link import Link
|
||||
from pip._internal.models.wheel import Wheel
|
||||
from pip._internal.pep425tags import interpreter_name, interpreter_version
|
||||
from pip._internal.utils.compat import expanduser
|
||||
from pip._internal.utils.misc import interpreter_name
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
from pip._internal.utils.urls import path_to_url
|
||||
|
@ -104,11 +103,8 @@ class Cache(object):
|
|||
# depending on the python version their setup.py is being run on,
|
||||
# and don't encode the difference in compatibility tags.
|
||||
# https://github.com/pypa/pip/issues/7296
|
||||
key_parts["interpreter"] = "{}-{}.{}".format(
|
||||
interpreter_name(),
|
||||
sys.version_info[0],
|
||||
sys.version_info[1],
|
||||
)
|
||||
key_parts["interpreter_name"] = interpreter_name()
|
||||
key_parts["interpreter_version"] = interpreter_version()
|
||||
|
||||
# Encode our key url with sha224, we'll use this because it has similar
|
||||
# security properties to sha256, but with a shorter total output (and
|
||||
|
|
|
@ -54,6 +54,9 @@ def get_abbr_impl():
|
|||
return pyimpl
|
||||
|
||||
|
||||
interpreter_name = get_abbr_impl
|
||||
|
||||
|
||||
def version_info_to_nodot(version_info):
|
||||
# type: (Tuple[int, ...]) -> str
|
||||
# Only use up to the first two numbers.
|
||||
|
@ -69,6 +72,9 @@ def get_impl_ver():
|
|||
return impl_ver
|
||||
|
||||
|
||||
interpreter_version = get_impl_ver
|
||||
|
||||
|
||||
def get_impl_version_info():
|
||||
# type: () -> Tuple[int, ...]
|
||||
"""Return sys.version_info-like tuple for use in decrementing the minor
|
||||
|
|
|
@ -11,7 +11,6 @@ import hashlib
|
|||
import io
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import posixpath
|
||||
import shutil
|
||||
import stat
|
||||
|
@ -880,13 +879,3 @@ def hash_file(path, blocksize=1 << 20):
|
|||
length += len(block)
|
||||
h.update(block)
|
||||
return (h, length) # type: ignore
|
||||
|
||||
|
||||
def interpreter_name():
|
||||
# type: () -> str
|
||||
try:
|
||||
name = sys.implementation.name # type: ignore
|
||||
except AttributeError: # pragma: no cover
|
||||
# Python 2.7 compatibility.
|
||||
name = platform.python_implementation().lower()
|
||||
return name
|
||||
|
|
Loading…
Reference in New Issue