Skip to content

Commit 6878a93

Browse files
committed
Switch to packaging.tags.compatible_tags
This also has the effect of backfilling minor versions for py*-based tags, increasing the number of wheels that can match.
1 parent d2fb9d3 commit 6878a93

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/pip/_internal/pep425tags.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import sysconfig
1010
import warnings
1111

12-
from pip._vendor.packaging.tags import Tag, mac_platforms
12+
from pip._vendor.packaging.tags import Tag, compatible_tags, mac_platforms
1313

1414
import pip._internal.utils.glibc
1515
from pip._internal.utils.compat import get_extension_suffixes
@@ -369,22 +369,26 @@ def get_supported(
369369
("%s%s" % (impl, other_version), abi, arch)
370370
)
371371

372-
# Has binaries, does not use the Python API:
373-
for arch in arches:
374-
supported.append(('py%s' % (current_version[0]), 'none', arch))
372+
if len(current_version) == 1:
373+
# XXX: Fake minor version to satisfy requirements of current interface.
374+
python_version = (int(current_version[0]), 9)
375+
else:
376+
python_version = int(current_version[0]), int(current_version[1:])
375377

376-
# No abi / arch, but requires our implementation:
377-
supported.append(('%s%s' % (impl, current_version), 'none', 'any'))
378+
interpreter = "{}{}".format(impl, current_version)
378379

379-
# No abi / arch, generic Python
380-
supported.append(('py%s' % (current_version,), 'none', 'any'))
381-
supported.append(('py%s' % (current_version[0]), 'none', 'any'))
382-
for other_version in other_versions:
383-
supported.append(
384-
('py%s' % (other_version,), 'none', 'any')
380+
supported.extend(
381+
compatible_tags(
382+
python_version=python_version,
383+
interpreter=interpreter,
384+
platforms=arches,
385385
)
386+
)
386387

387-
return [Tag(*parts) for parts in supported]
388+
return [
389+
Tag(*parts) if not isinstance(parts, Tag) else parts
390+
for parts in supported
391+
]
388392

389393

390394
implementation_tag = get_impl_tag()

0 commit comments

Comments
 (0)