mirror of https://github.com/pypa/pip
Fix DeprecationWarning: the imp module is deprecated in favour of importlib in pep425tags.py
This commit is contained in:
parent
cc50bd37b8
commit
860deed7db
|
@ -11,6 +11,7 @@ import warnings
|
|||
from collections import OrderedDict
|
||||
|
||||
import pip._internal.utils.glibc
|
||||
from pip._internal.utils.compat import get_extension_suffixes
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -252,10 +253,9 @@ def get_supported(versions=None, noarch=False, platform=None,
|
|||
abis[0:0] = [abi]
|
||||
|
||||
abi3s = set()
|
||||
import imp
|
||||
for suffix in imp.get_suffixes():
|
||||
if suffix[0].startswith('.abi'):
|
||||
abi3s.add(suffix[0].split('.', 2)[1])
|
||||
for suffix in get_extension_suffixes():
|
||||
if suffix.startswith('.abi'):
|
||||
abi3s.add(suffix.split('.', 2)[1])
|
||||
|
||||
abis.extend(sorted(list(abi3s)))
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ except ImportError:
|
|||
__all__ = [
|
||||
"ipaddress", "uses_pycache", "console_to_str", "native_str",
|
||||
"get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile", "get_terminal_size",
|
||||
"get_extension_suffixes",
|
||||
]
|
||||
|
||||
|
||||
|
@ -160,6 +161,18 @@ def get_path_uid(path):
|
|||
return file_uid
|
||||
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
from importlib.machinery import EXTENSION_SUFFIXES
|
||||
|
||||
def get_extension_suffixes():
|
||||
return EXTENSION_SUFFIXES
|
||||
else:
|
||||
from imp import get_suffixes
|
||||
|
||||
def get_extension_suffixes():
|
||||
return [suffix[0] for suffix in get_suffixes()]
|
||||
|
||||
|
||||
def expanduser(path):
|
||||
"""
|
||||
Expand ~ and ~user constructions.
|
||||
|
|
Loading…
Reference in New Issue