Skip to content

Commit

Permalink
Add a "cpNNN-none-any" tag (#541)
Browse files Browse the repository at this point in the history
Closes #511

See pypa/pip#10923 for motivation.

Co-authored-by: Brett Cannon <brett@python.org>
  • Loading branch information
joonis and brettcannon committed Aug 19, 2022
1 parent 1280051 commit b8b2f8a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packaging/tags.py
Expand Up @@ -499,6 +499,9 @@ def sys_tags(*, warn: bool = False) -> Iterator[Tag]:
yield from generic_tags()

if interp_name == "pp":
yield from compatible_tags(interpreter="pp3")
interp = "pp3"
elif interp_name == "cp":
interp = "cp" + interpreter_version(warn=warn)
else:
yield from compatible_tags()
interp = None
yield from compatible_tags(interpreter=interp)
13 changes: 13 additions & 0 deletions tests/test_tags.py
Expand Up @@ -1226,3 +1226,16 @@ def test_pypy_first_none_any_tag(self, monkeypatch):
break

assert tag == tags.Tag("pp3", "none", "any")

def test_cpython_first_none_any_tag(self, monkeypatch):
# When building the complete list of cpython tags, make sure the first
# <interpreter>-none-any one is cpxx-none-any
monkeypatch.setattr(tags, "interpreter_name", lambda: "cp")

# Find the first tag that is ABI- and platform-agnostic.
for tag in tags.sys_tags():
if tag.abi == "none" and tag.platform == "any":
break

interpreter = f"cp{tags.interpreter_version()}"
assert tag == tags.Tag(interpreter, "none", "any")

0 comments on commit b8b2f8a

Please sign in to comment.