Skip to content

Commit

Permalink
Simplify inclusion of abi3 in pep425tags
Browse files Browse the repository at this point in the history
abi3 refers to the CPython stable ABI, so we should only ensure it
applies in that particular case.

This simplifies the logic in get_platforms() and makes us more
compatible with the behavior of packaging.tags, which only includes abi3
for cpython_tags() and only the literal "abi3".
  • Loading branch information
chrahunt committed Nov 16, 2019
1 parent b224b34 commit 697f38f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/pip/_internal/pep425tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
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
Expand Down Expand Up @@ -361,12 +363,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')

Expand Down Expand Up @@ -419,11 +419,11 @@ 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))

Expand Down

0 comments on commit 697f38f

Please sign in to comment.