diff --git a/news/7327.removal b/news/7327.removal new file mode 100644 index 00000000000..b35f58e0fd2 --- /dev/null +++ b/news/7327.removal @@ -0,0 +1,2 @@ +Use literal "abi3" for wheel tag on CPython 3.x, to align with PEP 384 +which only defines it for this platform. diff --git a/src/pip/_internal/pep425tags.py b/src/pip/_internal/pep425tags.py index 1335e323e03..2d1fb1eb98b 100644 --- a/src/pip/_internal/pep425tags.py +++ b/src/pip/_internal/pep425tags.py @@ -10,13 +10,14 @@ import warnings from collections import OrderedDict +from pip._vendor.six import PY2 + import pip._internal.utils.glibc -from pip._internal.utils.compat import get_extension_suffixes from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import ( - Tuple, Callable, List, Optional, Union, Dict, Set + Tuple, Callable, List, Optional, Union, Dict ) Pep425Tag = Tuple[str, str, str] @@ -361,12 +362,10 @@ def get_supported( if abi: abis[0:0] = [abi] - abi3s = set() # type: Set[str] - for suffix in get_extension_suffixes(): - if suffix.startswith('.abi'): - abi3s.add(suffix.split('.', 2)[1]) + supports_abi3 = not PY2 and impl == "cp" - abis.extend(sorted(list(abi3s))) + if supports_abi3: + abis.append("abi3") abis.append('none') @@ -419,13 +418,13 @@ def get_supported( supported.append(('%s%s' % (impl, versions[0]), abi, arch)) # abi3 modules compatible with older version of Python - for version in versions[1:]: - # abi3 was introduced in Python 3.2 - if version in {'31', '30'}: - break - for abi in abi3s: # empty set if not Python 3 + if supports_abi3: + for version in versions[1:]: + # abi3 was introduced in Python 3.2 + if version in {'31', '30'}: + break for arch in arches: - supported.append(("%s%s" % (impl, version), abi, arch)) + supported.append(("%s%s" % (impl, version), "abi3", arch)) # Has binaries, does not use the Python API: for arch in arches: diff --git a/src/pip/_internal/utils/compat.py b/src/pip/_internal/utils/compat.py index 0468b2b14ea..26f6b0ea5d7 100644 --- a/src/pip/_internal/utils/compat.py +++ b/src/pip/_internal/utils/compat.py @@ -43,7 +43,6 @@ __all__ = [ "ipaddress", "uses_pycache", "console_to_str", "get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile", "get_terminal_size", - "get_extension_suffixes", ] @@ -189,19 +188,6 @@ def get_path_uid(path): return file_uid -if PY2: - from imp import get_suffixes - - def get_extension_suffixes(): - return [suffix[0] for suffix in get_suffixes()] - -else: - from importlib.machinery import EXTENSION_SUFFIXES - - def get_extension_suffixes(): - return EXTENSION_SUFFIXES - - def expanduser(path): # type: (str) -> str """