From d2bfc70e898dd83d3be7d89b146f0abaaa9f1f25 Mon Sep 17 00:00:00 2001 From: Jonathan Yoder Date: Wed, 8 Jul 2026 13:43:16 -0400 Subject: [PATCH 1/8] feat(tags): Tag type and ParseTag with 3-field expansion (#18632) --- tags/tag.go | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ tags/tag_test.go | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 tags/tag.go create mode 100644 tags/tag_test.go diff --git a/tags/tag.go b/tags/tag.go new file mode 100644 index 0000000..2c75015 --- /dev/null +++ b/tags/tag.go @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT +package tags + +import ( + "errors" + "strings" +) + +// ErrInvalidTag is returned by ParseTag for a malformed tag component. +var ErrInvalidTag = errors.New("invalid PEP 425 tag") + +// Tag is a single PEP 425 (interpreter, abi, platform) triple. +type Tag struct { + Interpreter string + ABI string + Platform string +} + +func (t Tag) String() string { return t.Interpreter + "-" + t.ABI + "-" + t.Platform } + +// ParseTag parses one PEP 425 tag component, expanding dot-compressed +// alternatives across all three fields as a full Cartesian product. +func ParseTag(s string) ([]Tag, error) { + parts := strings.Split(s, "-") + if len(parts) != 3 { + return nil, ErrInvalidTag + } + interps, err := splitField(parts[0]) + if err != nil { + return nil, err + } + abis, err := splitField(parts[1]) + if err != nil { + return nil, err + } + plats, err := splitField(parts[2]) + if err != nil { + return nil, err + } + out := make([]Tag, 0, len(interps)*len(abis)*len(plats)) + for _, i := range interps { + for _, a := range abis { + for _, p := range plats { + out = append(out, Tag{i, a, p}) + } + } + } + return out, nil +} + +func splitField(f string) ([]string, error) { + if f == "" { + return nil, ErrInvalidTag + } + elems := strings.Split(f, ".") + for _, e := range elems { + if e == "" { + return nil, ErrInvalidTag + } + } + return elems, nil +} diff --git a/tags/tag_test.go b/tags/tag_test.go new file mode 100644 index 0000000..55b112d --- /dev/null +++ b/tags/tag_test.go @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT +package tags + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestTagString(t *testing.T) { + assert.Equal(t, "cp311-cp311-manylinux_2_17_x86_64", + Tag{"cp311", "cp311", "manylinux_2_17_x86_64"}.String()) +} + +func TestParseTag_Simple(t *testing.T) { + got, err := ParseTag("cp311-cp311-manylinux_2_17_x86_64") + require.NoError(t, err) + assert.Equal(t, []Tag{{"cp311", "cp311", "manylinux_2_17_x86_64"}}, got) +} + +func TestParseTag_CartesianAllThreeFields(t *testing.T) { + got, err := ParseTag("cp36.cp37-abi3-manylinux1_x86_64.manylinux2010_x86_64") + require.NoError(t, err) + assert.ElementsMatch(t, []Tag{ + {"cp36", "abi3", "manylinux1_x86_64"}, + {"cp36", "abi3", "manylinux2010_x86_64"}, + {"cp37", "abi3", "manylinux1_x86_64"}, + {"cp37", "abi3", "manylinux2010_x86_64"}, + }, got) +} + +func TestParseTag_PurePython(t *testing.T) { + got, err := ParseTag("py2.py3-none-any") + require.NoError(t, err) + assert.ElementsMatch(t, []Tag{{"py2", "none", "any"}, {"py3", "none", "any"}}, got) +} + +func TestParseTag_Invalid(t *testing.T) { + for _, s := range []string{"cp311-cp311", "a-b-c-d", "cp311--any", "cp311-none-"} { + _, err := ParseTag(s) + require.Error(t, err, s) + } +} From a65b589b7053d1c7e4de83ca3518afd38c0eaa9f Mon Sep 17 00:00:00 2001 From: Jonathan Yoder Date: Wed, 8 Jul 2026 13:53:04 -0400 Subject: [PATCH 2/8] feat(tags): Target/Compile/Matcher, ordering, windows+generic generation, golden harness (#18632) --- tags/generate.go | 140 +++++++++++++++++++++++++++++ tags/golden_test.go | 45 ++++++++++ tags/target.go | 148 +++++++++++++++++++++++++++++++ tags/target_test.go | 33 +++++++ tags/testdata/gen_goldens.py | 53 +++++++++++ tags/testdata/generic-py3.json | 28 ++++++ tags/testdata/windows-amd64.json | 41 +++++++++ 7 files changed, 488 insertions(+) create mode 100644 tags/generate.go create mode 100644 tags/golden_test.go create mode 100644 tags/target.go create mode 100644 tags/target_test.go create mode 100644 tags/testdata/gen_goldens.py create mode 100644 tags/testdata/generic-py3.json create mode 100644 tags/testdata/windows-amd64.json diff --git a/tags/generate.go b/tags/generate.go new file mode 100644 index 0000000..5aaa86b --- /dev/null +++ b/tags/generate.go @@ -0,0 +1,140 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT +package tags + +import "strconv" + +// generateTags builds the full ordered, most-preferred-first list of +// compatible tags for a (validated) Target. The ordering follows the +// pypa/packaging convention (packaging.tags.cpython_tags / +// packaging.tags.compatible_tags), fixed to a specific declared target +// rather than the running interpreter/host: +// +// - "cp" targets: cp-cp- (exact ABI), then cp-abi3-, +// then cp-none-, then the abi3 walk down through older minor +// versions to cp32-abi3-; followed by the "compatible tier" +// py-none- down to py0-none-; then cp-none-any; +// then the universal py*-none-any tail. +// - "py" targets: the same compatible tier and universal tail, without any +// interpreter-specific entries (there is no compiled ABI to bind to). +func generateTags(t Target) []Tag { + if t.Implementation == "cp" { + return cpTags(t) + } + return pyTags(t) +} + +func cpTags(t Target) []Tag { + plats := t.platformTags() + interp := interpTag("cp", t.PyMajor, t.PyMinor) + + var out []Tag + appendPlatform := func(abi string) { + for _, p := range plats { + out = append(out, Tag{interp, abi, p}) + } + } + + // Exact ABI. + appendPlatform(interp) + + // abi3 was introduced in Python 3.2; free-threaded ABIs are out of scope + // for now (see deferred-features follow-up). + useAbi3 := t.PyMajor == 3 && t.PyMinor >= 2 + if useAbi3 { + appendPlatform("abi3") + } + + appendPlatform("none") + + if useAbi3 { + for minor := t.PyMinor - 1; minor >= 2; minor-- { + oldInterp := interpTag("cp", t.PyMajor, minor) + for _, p := range plats { + out = append(out, Tag{oldInterp, "abi3", p}) + } + } + } + + pyRange := pyInterpreterRange(t.PyMajor, t.PyMinor) + for _, v := range pyRange { + for _, p := range plats { + out = append(out, Tag{v, "none", p}) + } + } + + out = append(out, Tag{interp, "none", "any"}) + + for _, v := range pyRange { + out = append(out, Tag{v, "none", "any"}) + } + + return out +} + +func pyTags(t Target) []Tag { + plats := t.platformTags() + pyRange := pyInterpreterRange(t.PyMajor, t.PyMinor) + + var out []Tag + for _, v := range pyRange { + for _, p := range plats { + out = append(out, Tag{v, "none", p}) + } + } + for _, v := range pyRange { + out = append(out, Tag{v, "none", "any"}) + } + return out +} + +// pyInterpreterRange mirrors packaging._py_interpreter_range: the exact +// "py" version, then the major-only "py" version, then +// every older minor version down to "py0", descending. +func pyInterpreterRange(major, minor int) []string { + out := make([]string, 0, minor+2) + out = append(out, interpTag("py", major, minor)) + out = append(out, "py"+strconv.Itoa(major)) + for m := minor - 1; m >= 0; m-- { + out = append(out, interpTag("py", major, m)) + } + return out +} + +func interpTag(prefix string, major, minor int) string { + return prefix + strconv.Itoa(major) + strconv.Itoa(minor) +} + +// platformTags returns the target's platform component strings (there is +// usually exactly one, but the shape stays a slice for symmetry with the +// underlying pypa/packaging generators, some of which enumerate more than +// one platform tag per target, e.g. macOS format fallbacks in Task 4). +func (t Target) platformTags() []string { + switch t.OS { + case "windows": + return windowsPlatformTags(t.Arch) + case "linux": + // Implemented in #18632 Task 3. + panic("tags: linux platform tag generation not implemented (see #18632 Task 3)") + case "macos": + // Implemented in #18632 Task 4. + panic("tags: macOS platform tag generation not implemented (see #18632 Task 4)") + default: + // Unreachable: Target.validate rejects any other OS before + // generateTags is ever called. + panic("tags: unsupported OS " + t.OS) + } +} + +func windowsPlatformTags(arch string) []string { + switch arch { + case "amd64": + return []string{"win_amd64"} + case "x86": + return []string{"win32"} + case "arm64": + return []string{"win_arm64"} + default: + // Unreachable: Target.validate rejects any other windows arch. + panic("tags: unsupported windows arch " + arch) + } +} diff --git a/tags/golden_test.go b/tags/golden_test.go new file mode 100644 index 0000000..a783dc9 --- /dev/null +++ b/tags/golden_test.go @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT +package tags + +import ( + "encoding/json" + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" +) + +// goldenTargets maps a testdata/*.json fixture base name to the Target that +// produced it. Fixtures are generated by tags/testdata/gen_goldens.py from +// the reference Python "packaging" library; see that script for exact +// generation parameters. Tasks 3/4 add the linux/macOS entries. +var goldenTargets = map[string]Target{ + "windows-amd64.json": {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "windows", Arch: "amd64"}, + "generic-py3.json": {Implementation: "py", PyMajor: 3, PyMinor: 11, OS: "windows", Arch: "amd64"}, +} + +// TestGolden asserts that Target.Compile().Tags(), stringified in order, +// exactly matches the ordered tag list recorded by gen_goldens.py. +func TestGolden(t *testing.T) { + files, _ := filepath.Glob("testdata/*.json") + require.NotEmpty(t, files) + for _, f := range files { + name := filepath.Base(f) + t.Run(name, func(t *testing.T) { + var want []string + b, err := os.ReadFile(f) + require.NoError(t, err) + require.NoError(t, json.Unmarshal(b, &want)) + tg, ok := goldenTargets[name] + require.True(t, ok, "no Target mapping for %s", name) + m, err := tg.Compile() + require.NoError(t, err) + var got []string + for _, tag := range m.Tags() { + got = append(got, tag.String()) + } + require.Equal(t, want, got) + }) + } +} diff --git a/tags/target.go b/tags/target.go new file mode 100644 index 0000000..a976858 --- /dev/null +++ b/tags/target.go @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT +package tags + +import ( + "errors" + "fmt" +) + +// ErrUnsupportedTarget is returned by Target.Compile for a Target that is +// malformed or describes a platform combination this package does not (yet) +// support. +var ErrUnsupportedTarget = errors.New("unsupported or invalid target") + +// Target describes the interpreter/platform combination a Matcher should be +// compiled for. Not every field is meaningful for every OS; see Compile for +// the exact validation rules. +type Target struct { + // Implementation is the interpreter family: "cp" (CPython) or "py" + // (implementation-agnostic / pure Python). + Implementation string + // PyMajor and PyMinor are the target Python version, e.g. 3, 11 for + // Python 3.11. + PyMajor int + PyMinor int + + // OS is one of "linux", "macos", "windows". + OS string + // Arch is the target CPU architecture; valid values are OS-dependent. + Arch string + + // Libc and LibcMajor/LibcMinor are required when OS == "linux". + // Libc is "glibc" or "musl". + Libc string + LibcMajor int + LibcMinor int + + // MacMajor and MacMinor are required when OS == "macos". Only macOS 11 + // and later is supported. + MacMajor int + MacMinor int +} + +// Compile validates the Target and, if valid, builds the ordered set of +// compatible tags into a reusable Matcher. +func (t Target) Compile() (*Matcher, error) { + if err := t.validate(); err != nil { + return nil, err + } + ordered := generateTags(t) + rank := make(map[Tag]int, len(ordered)) + for i, tag := range ordered { + if _, exists := rank[tag]; !exists { + rank[tag] = i + } + } + return &Matcher{tags: ordered, rank: rank}, nil +} + +func (t Target) validate() error { + switch t.Implementation { + case "cp", "py": + default: + return fmt.Errorf("%w: unsupported implementation %q", ErrUnsupportedTarget, t.Implementation) + } + + switch t.OS { + case "linux": + if !contains(linuxArchs, t.Arch) { + return fmt.Errorf("%w: unsupported linux arch %q", ErrUnsupportedTarget, t.Arch) + } + if t.Libc != "glibc" && t.Libc != "musl" { + return fmt.Errorf("%w: linux target requires Libc \"glibc\" or \"musl\", got %q", ErrUnsupportedTarget, t.Libc) + } + if t.LibcMajor == 0 && t.LibcMinor == 0 { + return fmt.Errorf("%w: linux target requires a libc version", ErrUnsupportedTarget) + } + case "macos": + if !contains(macosArchs, t.Arch) { + return fmt.Errorf("%w: unsupported macOS arch %q", ErrUnsupportedTarget, t.Arch) + } + if t.MacMajor < 11 { + return fmt.Errorf("%w: macOS target requires major version >= 11, got %d", ErrUnsupportedTarget, t.MacMajor) + } + case "windows": + if !contains(windowsArchs, t.Arch) { + return fmt.Errorf("%w: unsupported windows arch %q", ErrUnsupportedTarget, t.Arch) + } + default: + return fmt.Errorf("%w: unsupported OS %q", ErrUnsupportedTarget, t.OS) + } + return nil +} + +var ( + // linuxArchs and macosArchs are validated by Compile ahead of the + // generation support landing in later tasks (#18632 Task 3/4), so that + // Compile's error behavior for malformed linux/macOS targets is already + // correct. + linuxArchs = []string{"x86_64", "i686", "aarch64", "armv7l", "ppc64", "ppc64le", "s390x", "riscv64", "loongarch64"} + macosArchs = []string{"x86_64", "arm64"} + windowsArchs = []string{"amd64", "x86", "arm64"} +) + +func contains(list []string, s string) bool { + for _, v := range list { + if v == s { + return true + } + } + return false +} + +// Matcher is a compiled, ordered set of compatible tags for a Target, with +// an index for O(1) priority lookup. The zero value is not usable; obtain a +// Matcher via Target.Compile. +type Matcher struct { + tags []Tag + rank map[Tag]int +} + +// Tags returns the full ordered list of compatible tags, most preferred +// first. +func (m *Matcher) Tags() []Tag { + return m.tags +} + +// Rank reports the best (lowest, most preferred) priority among the given +// tags that this Matcher supports. w is typically the output of ParseTag for +// one wheel's tag component, since a single component can expand to several +// Tag alternatives. ok is false if none of w is compatible. +func (m *Matcher) Rank(w []Tag) (rank int, ok bool) { + best := -1 + found := false + for _, tag := range w { + if r, exists := m.rank[tag]; exists && (!found || r < best) { + best = r + found = true + } + } + return best, found +} + +// IsCompatible reports whether any of the given tags is supported by this +// Matcher. +func (m *Matcher) IsCompatible(w []Tag) bool { + _, ok := m.Rank(w) + return ok +} diff --git a/tags/target_test.go b/tags/target_test.go new file mode 100644 index 0000000..94c37ee --- /dev/null +++ b/tags/target_test.go @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: Apache-2.0 OR MIT +package tags + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestCompile_RejectsUnsupported(t *testing.T) { + for _, tg := range []Target{ + {Implementation: "pp", PyMajor: 3, PyMinor: 11, OS: "linux", Arch: "x86_64", Libc: "glibc", LibcMajor: 2, LibcMinor: 28}, + {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "solaris", Arch: "x86_64"}, + {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "macos", Arch: "arm64", MacMajor: 10, MacMinor: 15}, // <11 + } { + _, err := tg.Compile() + require.Error(t, err) + } +} + +func TestMatcher_RankPrefersMoreSpecific(t *testing.T) { + m, err := Target{Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "windows", Arch: "amd64"}.Compile() + require.NoError(t, err) + // exact cp311-cp311-win_amd64 must outrank the pure py3-none-any universal + rExact, ok1 := m.Rank([]Tag{{"cp311", "cp311", "win_amd64"}}) + rUniv, ok2 := m.Rank([]Tag{{"py3", "none", "any"}}) + require.True(t, ok1) + require.True(t, ok2) + assert.Less(t, rExact, rUniv) + _, ok := m.Rank([]Tag{{"cp311", "cp311", "manylinux_2_17_x86_64"}}) + assert.False(t, ok) // linux tag incompatible with a windows target +} diff --git a/tags/testdata/gen_goldens.py b/tags/testdata/gen_goldens.py new file mode 100644 index 0000000..a7fd044 --- /dev/null +++ b/tags/testdata/gen_goldens.py @@ -0,0 +1,53 @@ +# Regenerate goldens: +# python3 -m pip install 'packaging==26.2' && python3 tags/testdata/gen_goldens.py +# +# Generated against packaging==26.2. +# +# Produces the reference ORDERED tag list for a handful of hand-picked +# targets, using packaging.tags directly. Each target here needs no +# host-detection monkeypatching: the platform list is passed explicitly to +# packaging.tags.cpython_tags/compatible_tags, so the result does not depend +# on the machine gen_goldens.py runs on. Linux/macOS targets (Tasks 3/4) DO +# require monkeypatching packaging's glibc/musl/arch detection and are added +# in their own sections of this file. +# +# Output: testdata/.json = ["tag", ...] in the exact order Go's +# tags.Target.Compile().Tags() must produce. tags/golden_test.go reads this +# JSON only; it never imports or shells out to Python. +import json +import pathlib + +import packaging.tags as T + +HERE = pathlib.Path(__file__).parent + + +def write(name, tag_iter): + tags = [str(tag) for tag in tag_iter] + (HERE / name).write_text(json.dumps(tags, indent=2) + "\n") + print(f"wrote {name} ({len(tags)} tags)") + + +# --- windows-amd64: cp311, Windows amd64 ----------------------------------- +# The full sys_tags()-equivalent ordering for a declared (not host-detected) +# CPython 3.11 / win_amd64 target: cpython_tags(...) followed by +# compatible_tags(..., interpreter="cp311", ...) over the same platform. +write( + "windows-amd64.json", + list(T.cpython_tags(python_version=(3, 11), abis=["cp311"], platforms=["win_amd64"])) + + list(T.compatible_tags(python_version=(3, 11), interpreter="cp311", platforms=["win_amd64"])), +) + +# --- generic-py3: pure-Python (Implementation "py"), same platform --------- +# Exercises the "py" (no compiled ABI) branch of the ordering framework: +# just the compatible tier + universal tail, with no interpreter-specific +# entries (compatible_tags with interpreter=None never emits "-none-any"). +write( + "generic-py3.json", + list(T.compatible_tags(python_version=(3, 11), interpreter=None, platforms=["win_amd64"])), +) + +# Linux targets (manylinux/musllinux + arch-dependent floor) are added in +# #18632 Task 3. + +# macOS targets (11+) are added in #18632 Task 4. diff --git a/tags/testdata/generic-py3.json b/tags/testdata/generic-py3.json new file mode 100644 index 0000000..6620e61 --- /dev/null +++ b/tags/testdata/generic-py3.json @@ -0,0 +1,28 @@ +[ + "py311-none-win_amd64", + "py3-none-win_amd64", + "py310-none-win_amd64", + "py39-none-win_amd64", + "py38-none-win_amd64", + "py37-none-win_amd64", + "py36-none-win_amd64", + "py35-none-win_amd64", + "py34-none-win_amd64", + "py33-none-win_amd64", + "py32-none-win_amd64", + "py31-none-win_amd64", + "py30-none-win_amd64", + "py311-none-any", + "py3-none-any", + "py310-none-any", + "py39-none-any", + "py38-none-any", + "py37-none-any", + "py36-none-any", + "py35-none-any", + "py34-none-any", + "py33-none-any", + "py32-none-any", + "py31-none-any", + "py30-none-any" +] diff --git a/tags/testdata/windows-amd64.json b/tags/testdata/windows-amd64.json new file mode 100644 index 0000000..29634eb --- /dev/null +++ b/tags/testdata/windows-amd64.json @@ -0,0 +1,41 @@ +[ + "cp311-cp311-win_amd64", + "cp311-abi3-win_amd64", + "cp311-none-win_amd64", + "cp310-abi3-win_amd64", + "cp39-abi3-win_amd64", + "cp38-abi3-win_amd64", + "cp37-abi3-win_amd64", + "cp36-abi3-win_amd64", + "cp35-abi3-win_amd64", + "cp34-abi3-win_amd64", + "cp33-abi3-win_amd64", + "cp32-abi3-win_amd64", + "py311-none-win_amd64", + "py3-none-win_amd64", + "py310-none-win_amd64", + "py39-none-win_amd64", + "py38-none-win_amd64", + "py37-none-win_amd64", + "py36-none-win_amd64", + "py35-none-win_amd64", + "py34-none-win_amd64", + "py33-none-win_amd64", + "py32-none-win_amd64", + "py31-none-win_amd64", + "py30-none-win_amd64", + "cp311-none-any", + "py311-none-any", + "py3-none-any", + "py310-none-any", + "py39-none-any", + "py38-none-any", + "py37-none-any", + "py36-none-any", + "py35-none-any", + "py34-none-any", + "py33-none-any", + "py32-none-any", + "py31-none-any", + "py30-none-any" +] From b0237ae9fc242bcb7f67852d2df6d59e010fb7f4 Mon Sep 17 00:00:00 2001 From: Jonathan Yoder Date: Wed, 8 Jul 2026 13:59:07 -0400 Subject: [PATCH 3/8] fix(tags): Compile returns error (not panic) for unsupported OS and invalid version (#18632) --- tags/generate.go | 38 ++++++++++++++++++++++++++------------ tags/target.go | 9 ++++++++- tags/target_test.go | 15 ++++++++++++++- 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/tags/generate.go b/tags/generate.go index 5aaa86b..37f24ac 100644 --- a/tags/generate.go +++ b/tags/generate.go @@ -1,7 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT package tags -import "strconv" +import ( + "fmt" + "strconv" +) // generateTags builds the full ordered, most-preferred-first list of // compatible tags for a (validated) Target. The ordering follows the @@ -16,15 +19,18 @@ import "strconv" // then the universal py*-none-any tail. // - "py" targets: the same compatible tier and universal tail, without any // interpreter-specific entries (there is no compiled ABI to bind to). -func generateTags(t Target) []Tag { +func generateTags(t Target) ([]Tag, error) { if t.Implementation == "cp" { return cpTags(t) } return pyTags(t) } -func cpTags(t Target) []Tag { - plats := t.platformTags() +func cpTags(t Target) ([]Tag, error) { + plats, err := t.platformTags() + if err != nil { + return nil, err + } interp := interpTag("cp", t.PyMajor, t.PyMinor) var out []Tag @@ -68,11 +74,14 @@ func cpTags(t Target) []Tag { out = append(out, Tag{v, "none", "any"}) } - return out + return out, nil } -func pyTags(t Target) []Tag { - plats := t.platformTags() +func pyTags(t Target) ([]Tag, error) { + plats, err := t.platformTags() + if err != nil { + return nil, err + } pyRange := pyInterpreterRange(t.PyMajor, t.PyMinor) var out []Tag @@ -84,7 +93,7 @@ func pyTags(t Target) []Tag { for _, v := range pyRange { out = append(out, Tag{v, "none", "any"}) } - return out + return out, nil } // pyInterpreterRange mirrors packaging._py_interpreter_range: the exact @@ -108,16 +117,21 @@ func interpTag(prefix string, major, minor int) string { // usually exactly one, but the shape stays a slice for symmetry with the // underlying pypa/packaging generators, some of which enumerate more than // one platform tag per target, e.g. macOS format fallbacks in Task 4). -func (t Target) platformTags() []string { +// +// linux and macOS generation are not yet implemented (see #18632 Task 3/4); +// until they land, both return ErrUnsupportedTarget rather than panicking, +// so that Target.Compile keeps its "validates and returns an error" contract +// for every OS Target.validate currently accepts. +func (t Target) platformTags() ([]string, error) { switch t.OS { case "windows": - return windowsPlatformTags(t.Arch) + return windowsPlatformTags(t.Arch), nil case "linux": // Implemented in #18632 Task 3. - panic("tags: linux platform tag generation not implemented (see #18632 Task 3)") + return nil, fmt.Errorf("%w: linux tag generation not yet implemented", ErrUnsupportedTarget) case "macos": // Implemented in #18632 Task 4. - panic("tags: macOS platform tag generation not implemented (see #18632 Task 4)") + return nil, fmt.Errorf("%w: macos tag generation not yet implemented", ErrUnsupportedTarget) default: // Unreachable: Target.validate rejects any other OS before // generateTags is ever called. diff --git a/tags/target.go b/tags/target.go index a976858..c84634b 100644 --- a/tags/target.go +++ b/tags/target.go @@ -46,7 +46,10 @@ func (t Target) Compile() (*Matcher, error) { if err := t.validate(); err != nil { return nil, err } - ordered := generateTags(t) + ordered, err := generateTags(t) + if err != nil { + return nil, err + } rank := make(map[Tag]int, len(ordered)) for i, tag := range ordered { if _, exists := rank[tag]; !exists { @@ -63,6 +66,10 @@ func (t Target) validate() error { return fmt.Errorf("%w: unsupported implementation %q", ErrUnsupportedTarget, t.Implementation) } + if t.PyMajor <= 0 || t.PyMinor < 0 { + return fmt.Errorf("%w: invalid Python version %d.%d", ErrUnsupportedTarget, t.PyMajor, t.PyMinor) + } + switch t.OS { case "linux": if !contains(linuxArchs, t.Arch) { diff --git a/tags/target_test.go b/tags/target_test.go index 94c37ee..38d3884 100644 --- a/tags/target_test.go +++ b/tags/target_test.go @@ -12,13 +12,26 @@ func TestCompile_RejectsUnsupported(t *testing.T) { for _, tg := range []Target{ {Implementation: "pp", PyMajor: 3, PyMinor: 11, OS: "linux", Arch: "x86_64", Libc: "glibc", LibcMajor: 2, LibcMinor: 28}, {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "solaris", Arch: "x86_64"}, - {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "macos", Arch: "arm64", MacMajor: 10, MacMinor: 15}, // <11 + {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "macos", Arch: "arm64", MacMajor: 10, MacMinor: 15}, // <11 + {Implementation: "cp", PyMajor: 3, PyMinor: -1, OS: "linux", Arch: "x86_64", Libc: "glibc", LibcMajor: 2, LibcMinor: 28}, // invalid PyMinor, must error not panic } { _, err := tg.Compile() require.Error(t, err) } } +// TestCompile_LinuxNotYetImplemented asserts that a well-formed linux Target +// returns ErrUnsupportedTarget from Compile rather than panicking, since +// linux platform tag generation is not implemented until #18632 Task 3. This +// case is expected to start succeeding once that task lands; at that point it +// should be replaced with a real linux golden-file assertion. +func TestCompile_LinuxNotYetImplemented(t *testing.T) { + tg := Target{Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "linux", Arch: "x86_64", Libc: "glibc", LibcMajor: 2, LibcMinor: 28} + _, err := tg.Compile() + require.Error(t, err) + require.ErrorIs(t, err, ErrUnsupportedTarget) +} + func TestMatcher_RankPrefersMoreSpecific(t *testing.T) { m, err := Target{Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "windows", Arch: "amd64"}.Compile() require.NoError(t, err) From f4f522705778841d5972064e9746325bf0e74605 Mon Sep 17 00:00:00 2001 From: Jonathan Yoder Date: Wed, 8 Jul 2026 14:08:45 -0400 Subject: [PATCH 4/8] feat(tags): linux manylinux/musllinux generation with arch-dependent floor (#18632) --- tags/generate.go | 116 +++- tags/golden_test.go | 14 +- tags/target_test.go | 47 +- tags/testdata/cp311_glibc228_x86_64.json | 716 +++++++++++++++++++++++ tags/testdata/cp312_musl12_x86_64.json | 125 ++++ tags/testdata/cp39_glibc217_aarch64.json | 77 +++ tags/testdata/gen_goldens.py | 66 ++- 7 files changed, 1142 insertions(+), 19 deletions(-) create mode 100644 tags/testdata/cp311_glibc228_x86_64.json create mode 100644 tags/testdata/cp312_musl12_x86_64.json create mode 100644 tags/testdata/cp39_glibc217_aarch64.json diff --git a/tags/generate.go b/tags/generate.go index 37f24ac..2ad5c55 100644 --- a/tags/generate.go +++ b/tags/generate.go @@ -118,17 +118,16 @@ func interpTag(prefix string, major, minor int) string { // underlying pypa/packaging generators, some of which enumerate more than // one platform tag per target, e.g. macOS format fallbacks in Task 4). // -// linux and macOS generation are not yet implemented (see #18632 Task 3/4); -// until they land, both return ErrUnsupportedTarget rather than panicking, -// so that Target.Compile keeps its "validates and returns an error" contract -// for every OS Target.validate currently accepts. +// macOS generation is not yet implemented (see #18632 Task 4); until it +// lands it returns ErrUnsupportedTarget rather than panicking, so that +// Target.Compile keeps its "validates and returns an error" contract for +// every OS Target.validate currently accepts. func (t Target) platformTags() ([]string, error) { switch t.OS { case "windows": return windowsPlatformTags(t.Arch), nil case "linux": - // Implemented in #18632 Task 3. - return nil, fmt.Errorf("%w: linux tag generation not yet implemented", ErrUnsupportedTarget) + return linuxPlatformTags(t), nil case "macos": // Implemented in #18632 Task 4. return nil, fmt.Errorf("%w: macos tag generation not yet implemented", ErrUnsupportedTarget) @@ -152,3 +151,108 @@ func windowsPlatformTags(arch string) []string { panic("tags: unsupported windows arch " + arch) } } + +// legacyManylinuxAlias is a pre-PEP 600 manylinux tag ("manylinux1", +// "manylinux2010", "manylinux2014") that aliases one specific glibc version +// for a given architecture. +type legacyManylinuxAlias struct { + name string + major int + minor int +} + +// manylinuxFloor is the oldest glibc version (major, minor) a given +// architecture's manylinux tags may claim, plus any legacy aliases that +// architecture supports. Values are uv's (github.com/astral-sh/uv) floor +// table, which matches pypa/packaging for x86_64/i686/aarch64/armv7l/ +// ppc64/ppc64le/s390x but additionally floors riscv64 and loongarch64 -- +// architectures packaging's own manylinux support predates. +// +// Rule (Global Constraints): a target declaring glibc (2, m) accepts a +// manylinux_2_y tag iff m >= y, down to this floor. +var manylinuxFloor = map[string]struct { + major, minor int + legacy []legacyManylinuxAlias +}{ + "x86_64": {2, 5, []legacyManylinuxAlias{ + {"manylinux1", 2, 5}, {"manylinux2010", 2, 12}, {"manylinux2014", 2, 17}, + }}, + "i686": {2, 5, []legacyManylinuxAlias{ + {"manylinux1", 2, 5}, {"manylinux2010", 2, 12}, {"manylinux2014", 2, 17}, + }}, + "aarch64": {2, 17, []legacyManylinuxAlias{{"manylinux2014", 2, 17}}}, + "armv7l": {2, 17, []legacyManylinuxAlias{{"manylinux2014", 2, 17}}}, + "ppc64": {2, 17, []legacyManylinuxAlias{{"manylinux2014", 2, 17}}}, + "ppc64le": {2, 17, []legacyManylinuxAlias{{"manylinux2014", 2, 17}}}, + "s390x": {2, 17, []legacyManylinuxAlias{{"manylinux2014", 2, 17}}}, + "riscv64": {2, 31, nil}, + // loongarch64's floor is uv's; pypa/packaging does not yet recognize + // this architecture at all. + "loongarch64": {2, 36, nil}, +} + +// linuxPlatformTags builds the ordered platform-tag list for a linux +// Target: manylinux tags (glibc targets) or musllinux tags (musl targets) +// from newest to oldest down to the architecture's floor, each accompanied +// by any applicable legacy manylinux alias immediately after the version it +// aliases, followed last by the bare "linux_" tag -- a deliberate +// divergence from pypa/packaging (which does not emit bare linux_* tags at +// all) to support PPM's local-source/Git-builder wheels, ranked below every +// manylinux/musllinux tag since those carry a documented compatibility +// guarantee that a bare linux tag does not. +func linuxPlatformTags(t Target) []string { + var plats []string + switch t.Libc { + case "glibc": + plats = manylinuxTags(t.Arch, t.LibcMajor, t.LibcMinor) + case "musl": + plats = musllinuxTags(t.Arch, t.LibcMajor, t.LibcMinor) + default: + // Unreachable: Target.validate requires Libc to be "glibc" or + // "musl". + panic("tags: unsupported linux libc " + t.Libc) + } + return append(plats, "linux_"+t.Arch) +} + +// manylinuxTags returns "manylinux___" for every glibc +// version from the target's declared version down to the architecture's +// floor (inclusive), newest first, interleaving legacy aliases immediately +// after the version they alias. Only floors within the target's declared +// glibc major version are considered (per the Global Constraints rule, +// stated only for glibc major 2, which every currently defined floor uses); +// a target whose major doesn't match its floor's, or whose declared version +// is below the floor, yields no manylinux tags. +func manylinuxTags(arch string, major, minor int) []string { + floor, ok := manylinuxFloor[arch] + if !ok { + // Unreachable: Target.validate restricts linux Arch to linuxArchs, + // and every entry there has a manylinuxFloor. + panic("tags: no manylinux floor for arch " + arch) + } + if major != floor.major || minor < floor.minor { + return nil + } + out := make([]string, 0, (minor-floor.minor+1)+len(floor.legacy)) + for m := minor; m >= floor.minor; m-- { + out = append(out, fmt.Sprintf("manylinux_%d_%d_%s", major, m, arch)) + for _, alias := range floor.legacy { + if alias.major == major && alias.minor == m { + out = append(out, alias.name+"_"+arch) + } + } + } + return out +} + +// musllinuxTags returns "musllinux___" for every musl +// version from the target's declared version down to musllinux__0, +// newest first. Unlike manylinux there is no architecture-dependent floor or +// legacy alias. +func musllinuxTags(arch string, major, minor int) []string { + out := make([]string, 0, minor+1) + for m := minor; m >= 0; m-- { + out = append(out, fmt.Sprintf("musllinux_%d_%d_%s", major, m, arch)) + } + return out +} diff --git a/tags/golden_test.go b/tags/golden_test.go index a783dc9..a52c0a9 100644 --- a/tags/golden_test.go +++ b/tags/golden_test.go @@ -13,10 +13,22 @@ import ( // goldenTargets maps a testdata/*.json fixture base name to the Target that // produced it. Fixtures are generated by tags/testdata/gen_goldens.py from // the reference Python "packaging" library; see that script for exact -// generation parameters. Tasks 3/4 add the linux/macOS entries. +// generation parameters. Task 4 adds the macOS entries. var goldenTargets = map[string]Target{ "windows-amd64.json": {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "windows", Arch: "amd64"}, "generic-py3.json": {Implementation: "py", PyMajor: 3, PyMinor: 11, OS: "windows", Arch: "amd64"}, + "cp311_glibc228_x86_64.json": { + Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "linux", Arch: "x86_64", + Libc: "glibc", LibcMajor: 2, LibcMinor: 28, + }, + "cp39_glibc217_aarch64.json": { + Implementation: "cp", PyMajor: 3, PyMinor: 9, OS: "linux", Arch: "aarch64", + Libc: "glibc", LibcMajor: 2, LibcMinor: 17, + }, + "cp312_musl12_x86_64.json": { + Implementation: "cp", PyMajor: 3, PyMinor: 12, OS: "linux", Arch: "x86_64", + Libc: "musl", LibcMajor: 1, LibcMinor: 2, + }, } // TestGolden asserts that Target.Compile().Tags(), stringified in order, diff --git a/tags/target_test.go b/tags/target_test.go index 38d3884..86d50a0 100644 --- a/tags/target_test.go +++ b/tags/target_test.go @@ -20,16 +20,43 @@ func TestCompile_RejectsUnsupported(t *testing.T) { } } -// TestCompile_LinuxNotYetImplemented asserts that a well-formed linux Target -// returns ErrUnsupportedTarget from Compile rather than panicking, since -// linux platform tag generation is not implemented until #18632 Task 3. This -// case is expected to start succeeding once that task lands; at that point it -// should be replaced with a real linux golden-file assertion. -func TestCompile_LinuxNotYetImplemented(t *testing.T) { - tg := Target{Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "linux", Arch: "x86_64", Libc: "glibc", LibcMajor: 2, LibcMinor: 28} - _, err := tg.Compile() - require.Error(t, err) - require.ErrorIs(t, err, ErrUnsupportedTarget) +// tagStrings stringifies a []Tag for easy Contains/NotContains assertions. +func tagStrings(tags []Tag) []string { + out := make([]string, len(tags)) + for i, tag := range tags { + out[i] = tag.String() + } + return out +} + +// TestLinux_ArchDependentFloor exercises the arch-dependent manylinux floor +// table directly (see Global Constraints): x86_64 walks all the way down to +// the manylinux1 (glibc 2.5) alias, while aarch64 floors at glibc 2.17 and +// never claims manylinux_2_5_aarch64 (2.5 predates aarch64 manylinux +// support entirely). +func TestLinux_ArchDependentFloor(t *testing.T) { + mX, err := Target{Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "linux", Arch: "x86_64", Libc: "glibc", LibcMajor: 2, LibcMinor: 28}.Compile() + require.NoError(t, err) + assert.Contains(t, tagStrings(mX.Tags()), "cp311-cp311-manylinux_2_5_x86_64") + assert.Contains(t, tagStrings(mX.Tags()), "cp311-cp311-manylinux1_x86_64") + + mA, err := Target{Implementation: "cp", PyMajor: 3, PyMinor: 9, OS: "linux", Arch: "aarch64", Libc: "glibc", LibcMajor: 2, LibcMinor: 17}.Compile() + require.NoError(t, err) + assert.NotContains(t, tagStrings(mA.Tags()), "cp39-cp39-manylinux_2_5_aarch64") + assert.Contains(t, tagStrings(mA.Tags()), "cp39-cp39-manylinux_2_17_aarch64") +} + +// TestLinux_BareLinuxRankedLast asserts the deliberate divergence from +// pypa/packaging: a bare "linux_" tag is accepted, but ranked below +// every manylinux/musllinux tag for the same target. +func TestLinux_BareLinuxRankedLast(t *testing.T) { + m, err := Target{Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "linux", Arch: "x86_64", Libc: "glibc", LibcMajor: 2, LibcMinor: 28}.Compile() + require.NoError(t, err) + rMany, ok1 := m.Rank([]Tag{{"cp311", "cp311", "manylinux_2_17_x86_64"}}) + rBare, ok2 := m.Rank([]Tag{{"cp311", "cp311", "linux_x86_64"}}) + require.True(t, ok1) + require.True(t, ok2) + assert.Less(t, rMany, rBare) } func TestMatcher_RankPrefersMoreSpecific(t *testing.T) { diff --git a/tags/testdata/cp311_glibc228_x86_64.json b/tags/testdata/cp311_glibc228_x86_64.json new file mode 100644 index 0000000..703f9a1 --- /dev/null +++ b/tags/testdata/cp311_glibc228_x86_64.json @@ -0,0 +1,716 @@ +[ + "cp311-cp311-manylinux_2_28_x86_64", + "cp311-cp311-manylinux_2_27_x86_64", + "cp311-cp311-manylinux_2_26_x86_64", + "cp311-cp311-manylinux_2_25_x86_64", + "cp311-cp311-manylinux_2_24_x86_64", + "cp311-cp311-manylinux_2_23_x86_64", + "cp311-cp311-manylinux_2_22_x86_64", + "cp311-cp311-manylinux_2_21_x86_64", + "cp311-cp311-manylinux_2_20_x86_64", + "cp311-cp311-manylinux_2_19_x86_64", + "cp311-cp311-manylinux_2_18_x86_64", + "cp311-cp311-manylinux_2_17_x86_64", + "cp311-cp311-manylinux2014_x86_64", + "cp311-cp311-manylinux_2_16_x86_64", + "cp311-cp311-manylinux_2_15_x86_64", + "cp311-cp311-manylinux_2_14_x86_64", + "cp311-cp311-manylinux_2_13_x86_64", + "cp311-cp311-manylinux_2_12_x86_64", + "cp311-cp311-manylinux2010_x86_64", + "cp311-cp311-manylinux_2_11_x86_64", + "cp311-cp311-manylinux_2_10_x86_64", + "cp311-cp311-manylinux_2_9_x86_64", + "cp311-cp311-manylinux_2_8_x86_64", + "cp311-cp311-manylinux_2_7_x86_64", + "cp311-cp311-manylinux_2_6_x86_64", + "cp311-cp311-manylinux_2_5_x86_64", + "cp311-cp311-manylinux1_x86_64", + "cp311-cp311-linux_x86_64", + "cp311-abi3-manylinux_2_28_x86_64", + "cp311-abi3-manylinux_2_27_x86_64", + "cp311-abi3-manylinux_2_26_x86_64", + "cp311-abi3-manylinux_2_25_x86_64", + "cp311-abi3-manylinux_2_24_x86_64", + "cp311-abi3-manylinux_2_23_x86_64", + "cp311-abi3-manylinux_2_22_x86_64", + "cp311-abi3-manylinux_2_21_x86_64", + "cp311-abi3-manylinux_2_20_x86_64", + "cp311-abi3-manylinux_2_19_x86_64", + "cp311-abi3-manylinux_2_18_x86_64", + "cp311-abi3-manylinux_2_17_x86_64", + "cp311-abi3-manylinux2014_x86_64", + "cp311-abi3-manylinux_2_16_x86_64", + "cp311-abi3-manylinux_2_15_x86_64", + "cp311-abi3-manylinux_2_14_x86_64", + "cp311-abi3-manylinux_2_13_x86_64", + "cp311-abi3-manylinux_2_12_x86_64", + "cp311-abi3-manylinux2010_x86_64", + "cp311-abi3-manylinux_2_11_x86_64", + "cp311-abi3-manylinux_2_10_x86_64", + "cp311-abi3-manylinux_2_9_x86_64", + "cp311-abi3-manylinux_2_8_x86_64", + "cp311-abi3-manylinux_2_7_x86_64", + "cp311-abi3-manylinux_2_6_x86_64", + "cp311-abi3-manylinux_2_5_x86_64", + "cp311-abi3-manylinux1_x86_64", + "cp311-abi3-linux_x86_64", + "cp311-none-manylinux_2_28_x86_64", + "cp311-none-manylinux_2_27_x86_64", + "cp311-none-manylinux_2_26_x86_64", + "cp311-none-manylinux_2_25_x86_64", + "cp311-none-manylinux_2_24_x86_64", + "cp311-none-manylinux_2_23_x86_64", + "cp311-none-manylinux_2_22_x86_64", + "cp311-none-manylinux_2_21_x86_64", + "cp311-none-manylinux_2_20_x86_64", + "cp311-none-manylinux_2_19_x86_64", + "cp311-none-manylinux_2_18_x86_64", + "cp311-none-manylinux_2_17_x86_64", + "cp311-none-manylinux2014_x86_64", + "cp311-none-manylinux_2_16_x86_64", + "cp311-none-manylinux_2_15_x86_64", + "cp311-none-manylinux_2_14_x86_64", + "cp311-none-manylinux_2_13_x86_64", + "cp311-none-manylinux_2_12_x86_64", + "cp311-none-manylinux2010_x86_64", + "cp311-none-manylinux_2_11_x86_64", + "cp311-none-manylinux_2_10_x86_64", + "cp311-none-manylinux_2_9_x86_64", + "cp311-none-manylinux_2_8_x86_64", + "cp311-none-manylinux_2_7_x86_64", + "cp311-none-manylinux_2_6_x86_64", + "cp311-none-manylinux_2_5_x86_64", + "cp311-none-manylinux1_x86_64", + "cp311-none-linux_x86_64", + "cp310-abi3-manylinux_2_28_x86_64", + "cp310-abi3-manylinux_2_27_x86_64", + "cp310-abi3-manylinux_2_26_x86_64", + "cp310-abi3-manylinux_2_25_x86_64", + "cp310-abi3-manylinux_2_24_x86_64", + "cp310-abi3-manylinux_2_23_x86_64", + "cp310-abi3-manylinux_2_22_x86_64", + "cp310-abi3-manylinux_2_21_x86_64", + "cp310-abi3-manylinux_2_20_x86_64", + "cp310-abi3-manylinux_2_19_x86_64", + "cp310-abi3-manylinux_2_18_x86_64", + "cp310-abi3-manylinux_2_17_x86_64", + "cp310-abi3-manylinux2014_x86_64", + "cp310-abi3-manylinux_2_16_x86_64", + "cp310-abi3-manylinux_2_15_x86_64", + "cp310-abi3-manylinux_2_14_x86_64", + "cp310-abi3-manylinux_2_13_x86_64", + "cp310-abi3-manylinux_2_12_x86_64", + "cp310-abi3-manylinux2010_x86_64", + "cp310-abi3-manylinux_2_11_x86_64", + "cp310-abi3-manylinux_2_10_x86_64", + "cp310-abi3-manylinux_2_9_x86_64", + "cp310-abi3-manylinux_2_8_x86_64", + "cp310-abi3-manylinux_2_7_x86_64", + "cp310-abi3-manylinux_2_6_x86_64", + "cp310-abi3-manylinux_2_5_x86_64", + "cp310-abi3-manylinux1_x86_64", + "cp310-abi3-linux_x86_64", + "cp39-abi3-manylinux_2_28_x86_64", + "cp39-abi3-manylinux_2_27_x86_64", + "cp39-abi3-manylinux_2_26_x86_64", + "cp39-abi3-manylinux_2_25_x86_64", + "cp39-abi3-manylinux_2_24_x86_64", + "cp39-abi3-manylinux_2_23_x86_64", + "cp39-abi3-manylinux_2_22_x86_64", + "cp39-abi3-manylinux_2_21_x86_64", + "cp39-abi3-manylinux_2_20_x86_64", + "cp39-abi3-manylinux_2_19_x86_64", + "cp39-abi3-manylinux_2_18_x86_64", + "cp39-abi3-manylinux_2_17_x86_64", + "cp39-abi3-manylinux2014_x86_64", + "cp39-abi3-manylinux_2_16_x86_64", + "cp39-abi3-manylinux_2_15_x86_64", + "cp39-abi3-manylinux_2_14_x86_64", + "cp39-abi3-manylinux_2_13_x86_64", + "cp39-abi3-manylinux_2_12_x86_64", + "cp39-abi3-manylinux2010_x86_64", + "cp39-abi3-manylinux_2_11_x86_64", + "cp39-abi3-manylinux_2_10_x86_64", + "cp39-abi3-manylinux_2_9_x86_64", + "cp39-abi3-manylinux_2_8_x86_64", + "cp39-abi3-manylinux_2_7_x86_64", + "cp39-abi3-manylinux_2_6_x86_64", + "cp39-abi3-manylinux_2_5_x86_64", + "cp39-abi3-manylinux1_x86_64", + "cp39-abi3-linux_x86_64", + "cp38-abi3-manylinux_2_28_x86_64", + "cp38-abi3-manylinux_2_27_x86_64", + "cp38-abi3-manylinux_2_26_x86_64", + "cp38-abi3-manylinux_2_25_x86_64", + "cp38-abi3-manylinux_2_24_x86_64", + "cp38-abi3-manylinux_2_23_x86_64", + "cp38-abi3-manylinux_2_22_x86_64", + "cp38-abi3-manylinux_2_21_x86_64", + "cp38-abi3-manylinux_2_20_x86_64", + "cp38-abi3-manylinux_2_19_x86_64", + "cp38-abi3-manylinux_2_18_x86_64", + "cp38-abi3-manylinux_2_17_x86_64", + "cp38-abi3-manylinux2014_x86_64", + "cp38-abi3-manylinux_2_16_x86_64", + "cp38-abi3-manylinux_2_15_x86_64", + "cp38-abi3-manylinux_2_14_x86_64", + "cp38-abi3-manylinux_2_13_x86_64", + "cp38-abi3-manylinux_2_12_x86_64", + "cp38-abi3-manylinux2010_x86_64", + "cp38-abi3-manylinux_2_11_x86_64", + "cp38-abi3-manylinux_2_10_x86_64", + "cp38-abi3-manylinux_2_9_x86_64", + "cp38-abi3-manylinux_2_8_x86_64", + "cp38-abi3-manylinux_2_7_x86_64", + "cp38-abi3-manylinux_2_6_x86_64", + "cp38-abi3-manylinux_2_5_x86_64", + "cp38-abi3-manylinux1_x86_64", + "cp38-abi3-linux_x86_64", + "cp37-abi3-manylinux_2_28_x86_64", + "cp37-abi3-manylinux_2_27_x86_64", + "cp37-abi3-manylinux_2_26_x86_64", + "cp37-abi3-manylinux_2_25_x86_64", + "cp37-abi3-manylinux_2_24_x86_64", + "cp37-abi3-manylinux_2_23_x86_64", + "cp37-abi3-manylinux_2_22_x86_64", + "cp37-abi3-manylinux_2_21_x86_64", + "cp37-abi3-manylinux_2_20_x86_64", + "cp37-abi3-manylinux_2_19_x86_64", + "cp37-abi3-manylinux_2_18_x86_64", + "cp37-abi3-manylinux_2_17_x86_64", + "cp37-abi3-manylinux2014_x86_64", + "cp37-abi3-manylinux_2_16_x86_64", + "cp37-abi3-manylinux_2_15_x86_64", + "cp37-abi3-manylinux_2_14_x86_64", + "cp37-abi3-manylinux_2_13_x86_64", + "cp37-abi3-manylinux_2_12_x86_64", + "cp37-abi3-manylinux2010_x86_64", + "cp37-abi3-manylinux_2_11_x86_64", + "cp37-abi3-manylinux_2_10_x86_64", + "cp37-abi3-manylinux_2_9_x86_64", + "cp37-abi3-manylinux_2_8_x86_64", + "cp37-abi3-manylinux_2_7_x86_64", + "cp37-abi3-manylinux_2_6_x86_64", + "cp37-abi3-manylinux_2_5_x86_64", + "cp37-abi3-manylinux1_x86_64", + "cp37-abi3-linux_x86_64", + "cp36-abi3-manylinux_2_28_x86_64", + "cp36-abi3-manylinux_2_27_x86_64", + "cp36-abi3-manylinux_2_26_x86_64", + "cp36-abi3-manylinux_2_25_x86_64", + "cp36-abi3-manylinux_2_24_x86_64", + "cp36-abi3-manylinux_2_23_x86_64", + "cp36-abi3-manylinux_2_22_x86_64", + "cp36-abi3-manylinux_2_21_x86_64", + "cp36-abi3-manylinux_2_20_x86_64", + "cp36-abi3-manylinux_2_19_x86_64", + "cp36-abi3-manylinux_2_18_x86_64", + "cp36-abi3-manylinux_2_17_x86_64", + "cp36-abi3-manylinux2014_x86_64", + "cp36-abi3-manylinux_2_16_x86_64", + "cp36-abi3-manylinux_2_15_x86_64", + "cp36-abi3-manylinux_2_14_x86_64", + "cp36-abi3-manylinux_2_13_x86_64", + "cp36-abi3-manylinux_2_12_x86_64", + "cp36-abi3-manylinux2010_x86_64", + "cp36-abi3-manylinux_2_11_x86_64", + "cp36-abi3-manylinux_2_10_x86_64", + "cp36-abi3-manylinux_2_9_x86_64", + "cp36-abi3-manylinux_2_8_x86_64", + "cp36-abi3-manylinux_2_7_x86_64", + "cp36-abi3-manylinux_2_6_x86_64", + "cp36-abi3-manylinux_2_5_x86_64", + "cp36-abi3-manylinux1_x86_64", + "cp36-abi3-linux_x86_64", + "cp35-abi3-manylinux_2_28_x86_64", + "cp35-abi3-manylinux_2_27_x86_64", + "cp35-abi3-manylinux_2_26_x86_64", + "cp35-abi3-manylinux_2_25_x86_64", + "cp35-abi3-manylinux_2_24_x86_64", + "cp35-abi3-manylinux_2_23_x86_64", + "cp35-abi3-manylinux_2_22_x86_64", + "cp35-abi3-manylinux_2_21_x86_64", + "cp35-abi3-manylinux_2_20_x86_64", + "cp35-abi3-manylinux_2_19_x86_64", + "cp35-abi3-manylinux_2_18_x86_64", + "cp35-abi3-manylinux_2_17_x86_64", + "cp35-abi3-manylinux2014_x86_64", + "cp35-abi3-manylinux_2_16_x86_64", + "cp35-abi3-manylinux_2_15_x86_64", + "cp35-abi3-manylinux_2_14_x86_64", + "cp35-abi3-manylinux_2_13_x86_64", + "cp35-abi3-manylinux_2_12_x86_64", + "cp35-abi3-manylinux2010_x86_64", + "cp35-abi3-manylinux_2_11_x86_64", + "cp35-abi3-manylinux_2_10_x86_64", + "cp35-abi3-manylinux_2_9_x86_64", + "cp35-abi3-manylinux_2_8_x86_64", + "cp35-abi3-manylinux_2_7_x86_64", + "cp35-abi3-manylinux_2_6_x86_64", + "cp35-abi3-manylinux_2_5_x86_64", + "cp35-abi3-manylinux1_x86_64", + "cp35-abi3-linux_x86_64", + "cp34-abi3-manylinux_2_28_x86_64", + "cp34-abi3-manylinux_2_27_x86_64", + "cp34-abi3-manylinux_2_26_x86_64", + "cp34-abi3-manylinux_2_25_x86_64", + "cp34-abi3-manylinux_2_24_x86_64", + "cp34-abi3-manylinux_2_23_x86_64", + "cp34-abi3-manylinux_2_22_x86_64", + "cp34-abi3-manylinux_2_21_x86_64", + "cp34-abi3-manylinux_2_20_x86_64", + "cp34-abi3-manylinux_2_19_x86_64", + "cp34-abi3-manylinux_2_18_x86_64", + "cp34-abi3-manylinux_2_17_x86_64", + "cp34-abi3-manylinux2014_x86_64", + "cp34-abi3-manylinux_2_16_x86_64", + "cp34-abi3-manylinux_2_15_x86_64", + "cp34-abi3-manylinux_2_14_x86_64", + "cp34-abi3-manylinux_2_13_x86_64", + "cp34-abi3-manylinux_2_12_x86_64", + "cp34-abi3-manylinux2010_x86_64", + "cp34-abi3-manylinux_2_11_x86_64", + "cp34-abi3-manylinux_2_10_x86_64", + "cp34-abi3-manylinux_2_9_x86_64", + "cp34-abi3-manylinux_2_8_x86_64", + "cp34-abi3-manylinux_2_7_x86_64", + "cp34-abi3-manylinux_2_6_x86_64", + "cp34-abi3-manylinux_2_5_x86_64", + "cp34-abi3-manylinux1_x86_64", + "cp34-abi3-linux_x86_64", + "cp33-abi3-manylinux_2_28_x86_64", + "cp33-abi3-manylinux_2_27_x86_64", + "cp33-abi3-manylinux_2_26_x86_64", + "cp33-abi3-manylinux_2_25_x86_64", + "cp33-abi3-manylinux_2_24_x86_64", + "cp33-abi3-manylinux_2_23_x86_64", + "cp33-abi3-manylinux_2_22_x86_64", + "cp33-abi3-manylinux_2_21_x86_64", + "cp33-abi3-manylinux_2_20_x86_64", + "cp33-abi3-manylinux_2_19_x86_64", + "cp33-abi3-manylinux_2_18_x86_64", + "cp33-abi3-manylinux_2_17_x86_64", + "cp33-abi3-manylinux2014_x86_64", + "cp33-abi3-manylinux_2_16_x86_64", + "cp33-abi3-manylinux_2_15_x86_64", + "cp33-abi3-manylinux_2_14_x86_64", + "cp33-abi3-manylinux_2_13_x86_64", + "cp33-abi3-manylinux_2_12_x86_64", + "cp33-abi3-manylinux2010_x86_64", + "cp33-abi3-manylinux_2_11_x86_64", + "cp33-abi3-manylinux_2_10_x86_64", + "cp33-abi3-manylinux_2_9_x86_64", + "cp33-abi3-manylinux_2_8_x86_64", + "cp33-abi3-manylinux_2_7_x86_64", + "cp33-abi3-manylinux_2_6_x86_64", + "cp33-abi3-manylinux_2_5_x86_64", + "cp33-abi3-manylinux1_x86_64", + "cp33-abi3-linux_x86_64", + "cp32-abi3-manylinux_2_28_x86_64", + "cp32-abi3-manylinux_2_27_x86_64", + "cp32-abi3-manylinux_2_26_x86_64", + "cp32-abi3-manylinux_2_25_x86_64", + "cp32-abi3-manylinux_2_24_x86_64", + "cp32-abi3-manylinux_2_23_x86_64", + "cp32-abi3-manylinux_2_22_x86_64", + "cp32-abi3-manylinux_2_21_x86_64", + "cp32-abi3-manylinux_2_20_x86_64", + "cp32-abi3-manylinux_2_19_x86_64", + "cp32-abi3-manylinux_2_18_x86_64", + "cp32-abi3-manylinux_2_17_x86_64", + "cp32-abi3-manylinux2014_x86_64", + "cp32-abi3-manylinux_2_16_x86_64", + "cp32-abi3-manylinux_2_15_x86_64", + "cp32-abi3-manylinux_2_14_x86_64", + "cp32-abi3-manylinux_2_13_x86_64", + "cp32-abi3-manylinux_2_12_x86_64", + "cp32-abi3-manylinux2010_x86_64", + "cp32-abi3-manylinux_2_11_x86_64", + "cp32-abi3-manylinux_2_10_x86_64", + "cp32-abi3-manylinux_2_9_x86_64", + "cp32-abi3-manylinux_2_8_x86_64", + "cp32-abi3-manylinux_2_7_x86_64", + "cp32-abi3-manylinux_2_6_x86_64", + "cp32-abi3-manylinux_2_5_x86_64", + "cp32-abi3-manylinux1_x86_64", + "cp32-abi3-linux_x86_64", + "py311-none-manylinux_2_28_x86_64", + "py311-none-manylinux_2_27_x86_64", + "py311-none-manylinux_2_26_x86_64", + "py311-none-manylinux_2_25_x86_64", + "py311-none-manylinux_2_24_x86_64", + "py311-none-manylinux_2_23_x86_64", + "py311-none-manylinux_2_22_x86_64", + "py311-none-manylinux_2_21_x86_64", + "py311-none-manylinux_2_20_x86_64", + "py311-none-manylinux_2_19_x86_64", + "py311-none-manylinux_2_18_x86_64", + "py311-none-manylinux_2_17_x86_64", + "py311-none-manylinux2014_x86_64", + "py311-none-manylinux_2_16_x86_64", + "py311-none-manylinux_2_15_x86_64", + "py311-none-manylinux_2_14_x86_64", + "py311-none-manylinux_2_13_x86_64", + "py311-none-manylinux_2_12_x86_64", + "py311-none-manylinux2010_x86_64", + "py311-none-manylinux_2_11_x86_64", + "py311-none-manylinux_2_10_x86_64", + "py311-none-manylinux_2_9_x86_64", + "py311-none-manylinux_2_8_x86_64", + "py311-none-manylinux_2_7_x86_64", + "py311-none-manylinux_2_6_x86_64", + "py311-none-manylinux_2_5_x86_64", + "py311-none-manylinux1_x86_64", + "py311-none-linux_x86_64", + "py3-none-manylinux_2_28_x86_64", + "py3-none-manylinux_2_27_x86_64", + "py3-none-manylinux_2_26_x86_64", + "py3-none-manylinux_2_25_x86_64", + "py3-none-manylinux_2_24_x86_64", + "py3-none-manylinux_2_23_x86_64", + "py3-none-manylinux_2_22_x86_64", + "py3-none-manylinux_2_21_x86_64", + "py3-none-manylinux_2_20_x86_64", + "py3-none-manylinux_2_19_x86_64", + "py3-none-manylinux_2_18_x86_64", + "py3-none-manylinux_2_17_x86_64", + "py3-none-manylinux2014_x86_64", + "py3-none-manylinux_2_16_x86_64", + "py3-none-manylinux_2_15_x86_64", + "py3-none-manylinux_2_14_x86_64", + "py3-none-manylinux_2_13_x86_64", + "py3-none-manylinux_2_12_x86_64", + "py3-none-manylinux2010_x86_64", + "py3-none-manylinux_2_11_x86_64", + "py3-none-manylinux_2_10_x86_64", + "py3-none-manylinux_2_9_x86_64", + "py3-none-manylinux_2_8_x86_64", + "py3-none-manylinux_2_7_x86_64", + "py3-none-manylinux_2_6_x86_64", + "py3-none-manylinux_2_5_x86_64", + "py3-none-manylinux1_x86_64", + "py3-none-linux_x86_64", + "py310-none-manylinux_2_28_x86_64", + "py310-none-manylinux_2_27_x86_64", + "py310-none-manylinux_2_26_x86_64", + "py310-none-manylinux_2_25_x86_64", + "py310-none-manylinux_2_24_x86_64", + "py310-none-manylinux_2_23_x86_64", + "py310-none-manylinux_2_22_x86_64", + "py310-none-manylinux_2_21_x86_64", + "py310-none-manylinux_2_20_x86_64", + "py310-none-manylinux_2_19_x86_64", + "py310-none-manylinux_2_18_x86_64", + "py310-none-manylinux_2_17_x86_64", + "py310-none-manylinux2014_x86_64", + "py310-none-manylinux_2_16_x86_64", + "py310-none-manylinux_2_15_x86_64", + "py310-none-manylinux_2_14_x86_64", + "py310-none-manylinux_2_13_x86_64", + "py310-none-manylinux_2_12_x86_64", + "py310-none-manylinux2010_x86_64", + "py310-none-manylinux_2_11_x86_64", + "py310-none-manylinux_2_10_x86_64", + "py310-none-manylinux_2_9_x86_64", + "py310-none-manylinux_2_8_x86_64", + "py310-none-manylinux_2_7_x86_64", + "py310-none-manylinux_2_6_x86_64", + "py310-none-manylinux_2_5_x86_64", + "py310-none-manylinux1_x86_64", + "py310-none-linux_x86_64", + "py39-none-manylinux_2_28_x86_64", + "py39-none-manylinux_2_27_x86_64", + "py39-none-manylinux_2_26_x86_64", + "py39-none-manylinux_2_25_x86_64", + "py39-none-manylinux_2_24_x86_64", + "py39-none-manylinux_2_23_x86_64", + "py39-none-manylinux_2_22_x86_64", + "py39-none-manylinux_2_21_x86_64", + "py39-none-manylinux_2_20_x86_64", + "py39-none-manylinux_2_19_x86_64", + "py39-none-manylinux_2_18_x86_64", + "py39-none-manylinux_2_17_x86_64", + "py39-none-manylinux2014_x86_64", + "py39-none-manylinux_2_16_x86_64", + "py39-none-manylinux_2_15_x86_64", + "py39-none-manylinux_2_14_x86_64", + "py39-none-manylinux_2_13_x86_64", + "py39-none-manylinux_2_12_x86_64", + "py39-none-manylinux2010_x86_64", + "py39-none-manylinux_2_11_x86_64", + "py39-none-manylinux_2_10_x86_64", + "py39-none-manylinux_2_9_x86_64", + "py39-none-manylinux_2_8_x86_64", + "py39-none-manylinux_2_7_x86_64", + "py39-none-manylinux_2_6_x86_64", + "py39-none-manylinux_2_5_x86_64", + "py39-none-manylinux1_x86_64", + "py39-none-linux_x86_64", + "py38-none-manylinux_2_28_x86_64", + "py38-none-manylinux_2_27_x86_64", + "py38-none-manylinux_2_26_x86_64", + "py38-none-manylinux_2_25_x86_64", + "py38-none-manylinux_2_24_x86_64", + "py38-none-manylinux_2_23_x86_64", + "py38-none-manylinux_2_22_x86_64", + "py38-none-manylinux_2_21_x86_64", + "py38-none-manylinux_2_20_x86_64", + "py38-none-manylinux_2_19_x86_64", + "py38-none-manylinux_2_18_x86_64", + "py38-none-manylinux_2_17_x86_64", + "py38-none-manylinux2014_x86_64", + "py38-none-manylinux_2_16_x86_64", + "py38-none-manylinux_2_15_x86_64", + "py38-none-manylinux_2_14_x86_64", + "py38-none-manylinux_2_13_x86_64", + "py38-none-manylinux_2_12_x86_64", + "py38-none-manylinux2010_x86_64", + "py38-none-manylinux_2_11_x86_64", + "py38-none-manylinux_2_10_x86_64", + "py38-none-manylinux_2_9_x86_64", + "py38-none-manylinux_2_8_x86_64", + "py38-none-manylinux_2_7_x86_64", + "py38-none-manylinux_2_6_x86_64", + "py38-none-manylinux_2_5_x86_64", + "py38-none-manylinux1_x86_64", + "py38-none-linux_x86_64", + "py37-none-manylinux_2_28_x86_64", + "py37-none-manylinux_2_27_x86_64", + "py37-none-manylinux_2_26_x86_64", + "py37-none-manylinux_2_25_x86_64", + "py37-none-manylinux_2_24_x86_64", + "py37-none-manylinux_2_23_x86_64", + "py37-none-manylinux_2_22_x86_64", + "py37-none-manylinux_2_21_x86_64", + "py37-none-manylinux_2_20_x86_64", + "py37-none-manylinux_2_19_x86_64", + "py37-none-manylinux_2_18_x86_64", + "py37-none-manylinux_2_17_x86_64", + "py37-none-manylinux2014_x86_64", + "py37-none-manylinux_2_16_x86_64", + "py37-none-manylinux_2_15_x86_64", + "py37-none-manylinux_2_14_x86_64", + "py37-none-manylinux_2_13_x86_64", + "py37-none-manylinux_2_12_x86_64", + "py37-none-manylinux2010_x86_64", + "py37-none-manylinux_2_11_x86_64", + "py37-none-manylinux_2_10_x86_64", + "py37-none-manylinux_2_9_x86_64", + "py37-none-manylinux_2_8_x86_64", + "py37-none-manylinux_2_7_x86_64", + "py37-none-manylinux_2_6_x86_64", + "py37-none-manylinux_2_5_x86_64", + "py37-none-manylinux1_x86_64", + "py37-none-linux_x86_64", + "py36-none-manylinux_2_28_x86_64", + "py36-none-manylinux_2_27_x86_64", + "py36-none-manylinux_2_26_x86_64", + "py36-none-manylinux_2_25_x86_64", + "py36-none-manylinux_2_24_x86_64", + "py36-none-manylinux_2_23_x86_64", + "py36-none-manylinux_2_22_x86_64", + "py36-none-manylinux_2_21_x86_64", + "py36-none-manylinux_2_20_x86_64", + "py36-none-manylinux_2_19_x86_64", + "py36-none-manylinux_2_18_x86_64", + "py36-none-manylinux_2_17_x86_64", + "py36-none-manylinux2014_x86_64", + "py36-none-manylinux_2_16_x86_64", + "py36-none-manylinux_2_15_x86_64", + "py36-none-manylinux_2_14_x86_64", + "py36-none-manylinux_2_13_x86_64", + "py36-none-manylinux_2_12_x86_64", + "py36-none-manylinux2010_x86_64", + "py36-none-manylinux_2_11_x86_64", + "py36-none-manylinux_2_10_x86_64", + "py36-none-manylinux_2_9_x86_64", + "py36-none-manylinux_2_8_x86_64", + "py36-none-manylinux_2_7_x86_64", + "py36-none-manylinux_2_6_x86_64", + "py36-none-manylinux_2_5_x86_64", + "py36-none-manylinux1_x86_64", + "py36-none-linux_x86_64", + "py35-none-manylinux_2_28_x86_64", + "py35-none-manylinux_2_27_x86_64", + "py35-none-manylinux_2_26_x86_64", + "py35-none-manylinux_2_25_x86_64", + "py35-none-manylinux_2_24_x86_64", + "py35-none-manylinux_2_23_x86_64", + "py35-none-manylinux_2_22_x86_64", + "py35-none-manylinux_2_21_x86_64", + "py35-none-manylinux_2_20_x86_64", + "py35-none-manylinux_2_19_x86_64", + "py35-none-manylinux_2_18_x86_64", + "py35-none-manylinux_2_17_x86_64", + "py35-none-manylinux2014_x86_64", + "py35-none-manylinux_2_16_x86_64", + "py35-none-manylinux_2_15_x86_64", + "py35-none-manylinux_2_14_x86_64", + "py35-none-manylinux_2_13_x86_64", + "py35-none-manylinux_2_12_x86_64", + "py35-none-manylinux2010_x86_64", + "py35-none-manylinux_2_11_x86_64", + "py35-none-manylinux_2_10_x86_64", + "py35-none-manylinux_2_9_x86_64", + "py35-none-manylinux_2_8_x86_64", + "py35-none-manylinux_2_7_x86_64", + "py35-none-manylinux_2_6_x86_64", + "py35-none-manylinux_2_5_x86_64", + "py35-none-manylinux1_x86_64", + "py35-none-linux_x86_64", + "py34-none-manylinux_2_28_x86_64", + "py34-none-manylinux_2_27_x86_64", + "py34-none-manylinux_2_26_x86_64", + "py34-none-manylinux_2_25_x86_64", + "py34-none-manylinux_2_24_x86_64", + "py34-none-manylinux_2_23_x86_64", + "py34-none-manylinux_2_22_x86_64", + "py34-none-manylinux_2_21_x86_64", + "py34-none-manylinux_2_20_x86_64", + "py34-none-manylinux_2_19_x86_64", + "py34-none-manylinux_2_18_x86_64", + "py34-none-manylinux_2_17_x86_64", + "py34-none-manylinux2014_x86_64", + "py34-none-manylinux_2_16_x86_64", + "py34-none-manylinux_2_15_x86_64", + "py34-none-manylinux_2_14_x86_64", + "py34-none-manylinux_2_13_x86_64", + "py34-none-manylinux_2_12_x86_64", + "py34-none-manylinux2010_x86_64", + "py34-none-manylinux_2_11_x86_64", + "py34-none-manylinux_2_10_x86_64", + "py34-none-manylinux_2_9_x86_64", + "py34-none-manylinux_2_8_x86_64", + "py34-none-manylinux_2_7_x86_64", + "py34-none-manylinux_2_6_x86_64", + "py34-none-manylinux_2_5_x86_64", + "py34-none-manylinux1_x86_64", + "py34-none-linux_x86_64", + "py33-none-manylinux_2_28_x86_64", + "py33-none-manylinux_2_27_x86_64", + "py33-none-manylinux_2_26_x86_64", + "py33-none-manylinux_2_25_x86_64", + "py33-none-manylinux_2_24_x86_64", + "py33-none-manylinux_2_23_x86_64", + "py33-none-manylinux_2_22_x86_64", + "py33-none-manylinux_2_21_x86_64", + "py33-none-manylinux_2_20_x86_64", + "py33-none-manylinux_2_19_x86_64", + "py33-none-manylinux_2_18_x86_64", + "py33-none-manylinux_2_17_x86_64", + "py33-none-manylinux2014_x86_64", + "py33-none-manylinux_2_16_x86_64", + "py33-none-manylinux_2_15_x86_64", + "py33-none-manylinux_2_14_x86_64", + "py33-none-manylinux_2_13_x86_64", + "py33-none-manylinux_2_12_x86_64", + "py33-none-manylinux2010_x86_64", + "py33-none-manylinux_2_11_x86_64", + "py33-none-manylinux_2_10_x86_64", + "py33-none-manylinux_2_9_x86_64", + "py33-none-manylinux_2_8_x86_64", + "py33-none-manylinux_2_7_x86_64", + "py33-none-manylinux_2_6_x86_64", + "py33-none-manylinux_2_5_x86_64", + "py33-none-manylinux1_x86_64", + "py33-none-linux_x86_64", + "py32-none-manylinux_2_28_x86_64", + "py32-none-manylinux_2_27_x86_64", + "py32-none-manylinux_2_26_x86_64", + "py32-none-manylinux_2_25_x86_64", + "py32-none-manylinux_2_24_x86_64", + "py32-none-manylinux_2_23_x86_64", + "py32-none-manylinux_2_22_x86_64", + "py32-none-manylinux_2_21_x86_64", + "py32-none-manylinux_2_20_x86_64", + "py32-none-manylinux_2_19_x86_64", + "py32-none-manylinux_2_18_x86_64", + "py32-none-manylinux_2_17_x86_64", + "py32-none-manylinux2014_x86_64", + "py32-none-manylinux_2_16_x86_64", + "py32-none-manylinux_2_15_x86_64", + "py32-none-manylinux_2_14_x86_64", + "py32-none-manylinux_2_13_x86_64", + "py32-none-manylinux_2_12_x86_64", + "py32-none-manylinux2010_x86_64", + "py32-none-manylinux_2_11_x86_64", + "py32-none-manylinux_2_10_x86_64", + "py32-none-manylinux_2_9_x86_64", + "py32-none-manylinux_2_8_x86_64", + "py32-none-manylinux_2_7_x86_64", + "py32-none-manylinux_2_6_x86_64", + "py32-none-manylinux_2_5_x86_64", + "py32-none-manylinux1_x86_64", + "py32-none-linux_x86_64", + "py31-none-manylinux_2_28_x86_64", + "py31-none-manylinux_2_27_x86_64", + "py31-none-manylinux_2_26_x86_64", + "py31-none-manylinux_2_25_x86_64", + "py31-none-manylinux_2_24_x86_64", + "py31-none-manylinux_2_23_x86_64", + "py31-none-manylinux_2_22_x86_64", + "py31-none-manylinux_2_21_x86_64", + "py31-none-manylinux_2_20_x86_64", + "py31-none-manylinux_2_19_x86_64", + "py31-none-manylinux_2_18_x86_64", + "py31-none-manylinux_2_17_x86_64", + "py31-none-manylinux2014_x86_64", + "py31-none-manylinux_2_16_x86_64", + "py31-none-manylinux_2_15_x86_64", + "py31-none-manylinux_2_14_x86_64", + "py31-none-manylinux_2_13_x86_64", + "py31-none-manylinux_2_12_x86_64", + "py31-none-manylinux2010_x86_64", + "py31-none-manylinux_2_11_x86_64", + "py31-none-manylinux_2_10_x86_64", + "py31-none-manylinux_2_9_x86_64", + "py31-none-manylinux_2_8_x86_64", + "py31-none-manylinux_2_7_x86_64", + "py31-none-manylinux_2_6_x86_64", + "py31-none-manylinux_2_5_x86_64", + "py31-none-manylinux1_x86_64", + "py31-none-linux_x86_64", + "py30-none-manylinux_2_28_x86_64", + "py30-none-manylinux_2_27_x86_64", + "py30-none-manylinux_2_26_x86_64", + "py30-none-manylinux_2_25_x86_64", + "py30-none-manylinux_2_24_x86_64", + "py30-none-manylinux_2_23_x86_64", + "py30-none-manylinux_2_22_x86_64", + "py30-none-manylinux_2_21_x86_64", + "py30-none-manylinux_2_20_x86_64", + "py30-none-manylinux_2_19_x86_64", + "py30-none-manylinux_2_18_x86_64", + "py30-none-manylinux_2_17_x86_64", + "py30-none-manylinux2014_x86_64", + "py30-none-manylinux_2_16_x86_64", + "py30-none-manylinux_2_15_x86_64", + "py30-none-manylinux_2_14_x86_64", + "py30-none-manylinux_2_13_x86_64", + "py30-none-manylinux_2_12_x86_64", + "py30-none-manylinux2010_x86_64", + "py30-none-manylinux_2_11_x86_64", + "py30-none-manylinux_2_10_x86_64", + "py30-none-manylinux_2_9_x86_64", + "py30-none-manylinux_2_8_x86_64", + "py30-none-manylinux_2_7_x86_64", + "py30-none-manylinux_2_6_x86_64", + "py30-none-manylinux_2_5_x86_64", + "py30-none-manylinux1_x86_64", + "py30-none-linux_x86_64", + "cp311-none-any", + "py311-none-any", + "py3-none-any", + "py310-none-any", + "py39-none-any", + "py38-none-any", + "py37-none-any", + "py36-none-any", + "py35-none-any", + "py34-none-any", + "py33-none-any", + "py32-none-any", + "py31-none-any", + "py30-none-any" +] diff --git a/tags/testdata/cp312_musl12_x86_64.json b/tags/testdata/cp312_musl12_x86_64.json new file mode 100644 index 0000000..9d3c5bd --- /dev/null +++ b/tags/testdata/cp312_musl12_x86_64.json @@ -0,0 +1,125 @@ +[ + "cp312-cp312-musllinux_1_2_x86_64", + "cp312-cp312-musllinux_1_1_x86_64", + "cp312-cp312-musllinux_1_0_x86_64", + "cp312-cp312-linux_x86_64", + "cp312-abi3-musllinux_1_2_x86_64", + "cp312-abi3-musllinux_1_1_x86_64", + "cp312-abi3-musllinux_1_0_x86_64", + "cp312-abi3-linux_x86_64", + "cp312-none-musllinux_1_2_x86_64", + "cp312-none-musllinux_1_1_x86_64", + "cp312-none-musllinux_1_0_x86_64", + "cp312-none-linux_x86_64", + "cp311-abi3-musllinux_1_2_x86_64", + "cp311-abi3-musllinux_1_1_x86_64", + "cp311-abi3-musllinux_1_0_x86_64", + "cp311-abi3-linux_x86_64", + "cp310-abi3-musllinux_1_2_x86_64", + "cp310-abi3-musllinux_1_1_x86_64", + "cp310-abi3-musllinux_1_0_x86_64", + "cp310-abi3-linux_x86_64", + "cp39-abi3-musllinux_1_2_x86_64", + "cp39-abi3-musllinux_1_1_x86_64", + "cp39-abi3-musllinux_1_0_x86_64", + "cp39-abi3-linux_x86_64", + "cp38-abi3-musllinux_1_2_x86_64", + "cp38-abi3-musllinux_1_1_x86_64", + "cp38-abi3-musllinux_1_0_x86_64", + "cp38-abi3-linux_x86_64", + "cp37-abi3-musllinux_1_2_x86_64", + "cp37-abi3-musllinux_1_1_x86_64", + "cp37-abi3-musllinux_1_0_x86_64", + "cp37-abi3-linux_x86_64", + "cp36-abi3-musllinux_1_2_x86_64", + "cp36-abi3-musllinux_1_1_x86_64", + "cp36-abi3-musllinux_1_0_x86_64", + "cp36-abi3-linux_x86_64", + "cp35-abi3-musllinux_1_2_x86_64", + "cp35-abi3-musllinux_1_1_x86_64", + "cp35-abi3-musllinux_1_0_x86_64", + "cp35-abi3-linux_x86_64", + "cp34-abi3-musllinux_1_2_x86_64", + "cp34-abi3-musllinux_1_1_x86_64", + "cp34-abi3-musllinux_1_0_x86_64", + "cp34-abi3-linux_x86_64", + "cp33-abi3-musllinux_1_2_x86_64", + "cp33-abi3-musllinux_1_1_x86_64", + "cp33-abi3-musllinux_1_0_x86_64", + "cp33-abi3-linux_x86_64", + "cp32-abi3-musllinux_1_2_x86_64", + "cp32-abi3-musllinux_1_1_x86_64", + "cp32-abi3-musllinux_1_0_x86_64", + "cp32-abi3-linux_x86_64", + "py312-none-musllinux_1_2_x86_64", + "py312-none-musllinux_1_1_x86_64", + "py312-none-musllinux_1_0_x86_64", + "py312-none-linux_x86_64", + "py3-none-musllinux_1_2_x86_64", + "py3-none-musllinux_1_1_x86_64", + "py3-none-musllinux_1_0_x86_64", + "py3-none-linux_x86_64", + "py311-none-musllinux_1_2_x86_64", + "py311-none-musllinux_1_1_x86_64", + "py311-none-musllinux_1_0_x86_64", + "py311-none-linux_x86_64", + "py310-none-musllinux_1_2_x86_64", + "py310-none-musllinux_1_1_x86_64", + "py310-none-musllinux_1_0_x86_64", + "py310-none-linux_x86_64", + "py39-none-musllinux_1_2_x86_64", + "py39-none-musllinux_1_1_x86_64", + "py39-none-musllinux_1_0_x86_64", + "py39-none-linux_x86_64", + "py38-none-musllinux_1_2_x86_64", + "py38-none-musllinux_1_1_x86_64", + "py38-none-musllinux_1_0_x86_64", + "py38-none-linux_x86_64", + "py37-none-musllinux_1_2_x86_64", + "py37-none-musllinux_1_1_x86_64", + "py37-none-musllinux_1_0_x86_64", + "py37-none-linux_x86_64", + "py36-none-musllinux_1_2_x86_64", + "py36-none-musllinux_1_1_x86_64", + "py36-none-musllinux_1_0_x86_64", + "py36-none-linux_x86_64", + "py35-none-musllinux_1_2_x86_64", + "py35-none-musllinux_1_1_x86_64", + "py35-none-musllinux_1_0_x86_64", + "py35-none-linux_x86_64", + "py34-none-musllinux_1_2_x86_64", + "py34-none-musllinux_1_1_x86_64", + "py34-none-musllinux_1_0_x86_64", + "py34-none-linux_x86_64", + "py33-none-musllinux_1_2_x86_64", + "py33-none-musllinux_1_1_x86_64", + "py33-none-musllinux_1_0_x86_64", + "py33-none-linux_x86_64", + "py32-none-musllinux_1_2_x86_64", + "py32-none-musllinux_1_1_x86_64", + "py32-none-musllinux_1_0_x86_64", + "py32-none-linux_x86_64", + "py31-none-musllinux_1_2_x86_64", + "py31-none-musllinux_1_1_x86_64", + "py31-none-musllinux_1_0_x86_64", + "py31-none-linux_x86_64", + "py30-none-musllinux_1_2_x86_64", + "py30-none-musllinux_1_1_x86_64", + "py30-none-musllinux_1_0_x86_64", + "py30-none-linux_x86_64", + "cp312-none-any", + "py312-none-any", + "py3-none-any", + "py311-none-any", + "py310-none-any", + "py39-none-any", + "py38-none-any", + "py37-none-any", + "py36-none-any", + "py35-none-any", + "py34-none-any", + "py33-none-any", + "py32-none-any", + "py31-none-any", + "py30-none-any" +] diff --git a/tags/testdata/cp39_glibc217_aarch64.json b/tags/testdata/cp39_glibc217_aarch64.json new file mode 100644 index 0000000..689be99 --- /dev/null +++ b/tags/testdata/cp39_glibc217_aarch64.json @@ -0,0 +1,77 @@ +[ + "cp39-cp39-manylinux_2_17_aarch64", + "cp39-cp39-manylinux2014_aarch64", + "cp39-cp39-linux_aarch64", + "cp39-abi3-manylinux_2_17_aarch64", + "cp39-abi3-manylinux2014_aarch64", + "cp39-abi3-linux_aarch64", + "cp39-none-manylinux_2_17_aarch64", + "cp39-none-manylinux2014_aarch64", + "cp39-none-linux_aarch64", + "cp38-abi3-manylinux_2_17_aarch64", + "cp38-abi3-manylinux2014_aarch64", + "cp38-abi3-linux_aarch64", + "cp37-abi3-manylinux_2_17_aarch64", + "cp37-abi3-manylinux2014_aarch64", + "cp37-abi3-linux_aarch64", + "cp36-abi3-manylinux_2_17_aarch64", + "cp36-abi3-manylinux2014_aarch64", + "cp36-abi3-linux_aarch64", + "cp35-abi3-manylinux_2_17_aarch64", + "cp35-abi3-manylinux2014_aarch64", + "cp35-abi3-linux_aarch64", + "cp34-abi3-manylinux_2_17_aarch64", + "cp34-abi3-manylinux2014_aarch64", + "cp34-abi3-linux_aarch64", + "cp33-abi3-manylinux_2_17_aarch64", + "cp33-abi3-manylinux2014_aarch64", + "cp33-abi3-linux_aarch64", + "cp32-abi3-manylinux_2_17_aarch64", + "cp32-abi3-manylinux2014_aarch64", + "cp32-abi3-linux_aarch64", + "py39-none-manylinux_2_17_aarch64", + "py39-none-manylinux2014_aarch64", + "py39-none-linux_aarch64", + "py3-none-manylinux_2_17_aarch64", + "py3-none-manylinux2014_aarch64", + "py3-none-linux_aarch64", + "py38-none-manylinux_2_17_aarch64", + "py38-none-manylinux2014_aarch64", + "py38-none-linux_aarch64", + "py37-none-manylinux_2_17_aarch64", + "py37-none-manylinux2014_aarch64", + "py37-none-linux_aarch64", + "py36-none-manylinux_2_17_aarch64", + "py36-none-manylinux2014_aarch64", + "py36-none-linux_aarch64", + "py35-none-manylinux_2_17_aarch64", + "py35-none-manylinux2014_aarch64", + "py35-none-linux_aarch64", + "py34-none-manylinux_2_17_aarch64", + "py34-none-manylinux2014_aarch64", + "py34-none-linux_aarch64", + "py33-none-manylinux_2_17_aarch64", + "py33-none-manylinux2014_aarch64", + "py33-none-linux_aarch64", + "py32-none-manylinux_2_17_aarch64", + "py32-none-manylinux2014_aarch64", + "py32-none-linux_aarch64", + "py31-none-manylinux_2_17_aarch64", + "py31-none-manylinux2014_aarch64", + "py31-none-linux_aarch64", + "py30-none-manylinux_2_17_aarch64", + "py30-none-manylinux2014_aarch64", + "py30-none-linux_aarch64", + "cp39-none-any", + "py39-none-any", + "py3-none-any", + "py38-none-any", + "py37-none-any", + "py36-none-any", + "py35-none-any", + "py34-none-any", + "py33-none-any", + "py32-none-any", + "py31-none-any", + "py30-none-any" +] diff --git a/tags/testdata/gen_goldens.py b/tags/testdata/gen_goldens.py index a7fd044..6156b4a 100644 --- a/tags/testdata/gen_goldens.py +++ b/tags/testdata/gen_goldens.py @@ -47,7 +47,69 @@ def write(name, tag_iter): list(T.compatible_tags(python_version=(3, 11), interpreter=None, platforms=["win_amd64"])), ) -# Linux targets (manylinux/musllinux + arch-dependent floor) are added in -# #18632 Task 3. +# --- linux targets: manylinux/musllinux + arch-dependent glibc floor ------- +# +# packaging computes manylinux/musllinux platform tags from *detected host +# state* (the running interpreter's glibc/musl version, by way of +# packaging._manylinux._get_glibc_version / packaging._musllinux._get_musl_version), +# not from an explicit parameter. To fake an arbitrary declared target (not +# this machine's), we monkeypatch those two host-detection functions to the +# target's version, and sysconfig.get_platform to the target's arch, then +# drive the real packaging.tags._linux_platforms() generator (the same one +# packaging.tags.platform_tags() uses on an actual Linux host). This is the +# same monkeypatch-the-detector technique packaging's own test suite uses +# (see upstream tests/test_manylinux.py / test_musllinux.py). +# +# Per our Libc-per-Target design, a target is glibc-only or musl-only +# (never both): for a glibc target we additionally force musl detection to +# "not musl" (None), and for a musl target we force glibc detection to +# "undetected" ((-1, -1), packaging's own sentinel for "no glibc here"), so +# _linux_platforms() naturally yields only the one family. +import packaging._manylinux as _manylinux +import packaging._musllinux as _musllinux +import sysconfig + + +def _linux_platform_list(arch, libc, libc_major, libc_minor): + sysconfig.get_platform = lambda: f"linux-{arch}" + if libc == "glibc": + _manylinux._get_glibc_version = lambda: _manylinux._GLibCVersion(libc_major, libc_minor) + _musllinux._get_musl_version = lambda executable: None + elif libc == "musl": + _musllinux._get_musl_version = lambda executable: _musllinux._MuslVersion(libc_major, libc_minor) + _manylinux._get_glibc_version = lambda: _manylinux._GLibCVersion(-1, -1) + else: + raise ValueError(f"unknown libc {libc!r}") + platforms = list(T._linux_platforms()) + # packaging.tags._linux_platforms() already yields the bare "linux_" + # tag last (after manylinux/musllinux), matching our own "ranked last" + # design decision. Reorder defensively anyway, so this generator stays + # correct even if a future packaging release changes that ordering. + bare = f"linux_{arch}" + platforms = [p for p in platforms if p != bare] + [p for p in platforms if p == bare] + return platforms + + +def write_linux(name, python_version, interpreter, arch, libc, libc_major, libc_minor): + platforms = _linux_platform_list(arch, libc, libc_major, libc_minor) + write( + name, + list(T.cpython_tags(python_version=python_version, abis=[interpreter], platforms=platforms)) + + list(T.compatible_tags(python_version=python_version, interpreter=interpreter, platforms=platforms)), + ) + + +# cp311, x86_64, glibc 2.28: walks the full manylinux1(2.5)..manylinux_2_28 +# ladder with all three legacy aliases (manylinux1/2010/2014). +write_linux("cp311_glibc228_x86_64.json", (3, 11), "cp311", "x86_64", "glibc", 2, 28) + +# cp39, aarch64, glibc 2.17: floors exactly at manylinux_2_17 (+ manylinux2014 +# alias only) -- no manylinux_2_5_aarch64, since aarch64's floor is 2.17, not +# x86_64's 2.5. +write_linux("cp39_glibc217_aarch64.json", (3, 9), "cp39", "aarch64", "glibc", 2, 17) + +# cp312, x86_64, musl 1.2: musllinux_1_2 down to musllinux_1_0, no manylinux +# tags at all (this target has no glibc). +write_linux("cp312_musl12_x86_64.json", (3, 12), "cp312", "x86_64", "musl", 1, 2) # macOS targets (11+) are added in #18632 Task 4. From f7775c7f609acaf7d25e7afda8a8d2e06f2d3567 Mon Sep 17 00:00:00 2001 From: Jonathan Yoder Date: Wed, 8 Jul 2026 14:12:51 -0400 Subject: [PATCH 5/8] fix(tags): validate libc version to avoid Compile panic on malformed target (#18632) --- tags/target.go | 3 +++ tags/target_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/tags/target.go b/tags/target.go index c84634b..01575bd 100644 --- a/tags/target.go +++ b/tags/target.go @@ -81,6 +81,9 @@ func (t Target) validate() error { if t.LibcMajor == 0 && t.LibcMinor == 0 { return fmt.Errorf("%w: linux target requires a libc version", ErrUnsupportedTarget) } + if t.LibcMajor <= 0 || t.LibcMinor < 0 { + return fmt.Errorf("%w: invalid libc version %d.%d", ErrUnsupportedTarget, t.LibcMajor, t.LibcMinor) + } case "macos": if !contains(macosArchs, t.Arch) { return fmt.Errorf("%w: unsupported macOS arch %q", ErrUnsupportedTarget, t.Arch) diff --git a/tags/target_test.go b/tags/target_test.go index 86d50a0..8e2da50 100644 --- a/tags/target_test.go +++ b/tags/target_test.go @@ -14,6 +14,7 @@ func TestCompile_RejectsUnsupported(t *testing.T) { {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "solaris", Arch: "x86_64"}, {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "macos", Arch: "arm64", MacMajor: 10, MacMinor: 15}, // <11 {Implementation: "cp", PyMajor: 3, PyMinor: -1, OS: "linux", Arch: "x86_64", Libc: "glibc", LibcMajor: 2, LibcMinor: 28}, // invalid PyMinor, must error not panic + {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "linux", Arch: "x86_64", Libc: "musl", LibcMajor: 1, LibcMinor: -2}, // invalid negative LibcMinor, must error not panic } { _, err := tg.Compile() require.Error(t, err) From 1d1c0d854339c8cbdeef8dac502e157748876d76 Mon Sep 17 00:00:00 2001 From: Jonathan Yoder Date: Wed, 8 Jul 2026 14:19:02 -0400 Subject: [PATCH 6/8] feat(tags): macOS 11+ tag generation (#18632) Implements the macos branch of platformTags(): macosx__0_ for every major version M from the target's declared major down to 11, using the arch's binary-format list (x86_64: x86_64/intel/fat64/fat32/ universal2/universal; arm64: arm64/universal2). Pre-11 compatibility fallbacks are intentionally out of scope. Also rejects Target.MacMinor < 0 in validate(), matching the existing PyMinor/LibcMinor guards against a negative-cap Compile panic. Adds cp310_macos12_arm64 and cp312_macos14_x86_64 golden fixtures (generated via packaging.tags.mac_platforms, filtered to drop the pre-11 compatibility tail) plus a focused unit test on arch-dependent format lists and the 11-floor version walk. --- tags/generate.go | 45 +- tags/golden_test.go | 10 +- tags/target.go | 8 +- tags/target_test.go | 30 ++ tags/testdata/cp310_macos12_arm64.json | 107 ++++ tags/testdata/cp312_macos14_x86_64.json | 665 ++++++++++++++++++++++++ tags/testdata/gen_goldens.py | 32 +- 7 files changed, 886 insertions(+), 11 deletions(-) create mode 100644 tags/testdata/cp310_macos12_arm64.json create mode 100644 tags/testdata/cp312_macos14_x86_64.json diff --git a/tags/generate.go b/tags/generate.go index 2ad5c55..9446ece 100644 --- a/tags/generate.go +++ b/tags/generate.go @@ -116,12 +116,8 @@ func interpTag(prefix string, major, minor int) string { // platformTags returns the target's platform component strings (there is // usually exactly one, but the shape stays a slice for symmetry with the // underlying pypa/packaging generators, some of which enumerate more than -// one platform tag per target, e.g. macOS format fallbacks in Task 4). -// -// macOS generation is not yet implemented (see #18632 Task 4); until it -// lands it returns ErrUnsupportedTarget rather than panicking, so that -// Target.Compile keeps its "validates and returns an error" contract for -// every OS Target.validate currently accepts. +// one platform tag per target, e.g. macOS's per-major-version format +// fallbacks). func (t Target) platformTags() ([]string, error) { switch t.OS { case "windows": @@ -129,8 +125,7 @@ func (t Target) platformTags() ([]string, error) { case "linux": return linuxPlatformTags(t), nil case "macos": - // Implemented in #18632 Task 4. - return nil, fmt.Errorf("%w: macos tag generation not yet implemented", ErrUnsupportedTarget) + return macosPlatformTags(t.Arch, t.MacMajor), nil default: // Unreachable: Target.validate rejects any other OS before // generateTags is ever called. @@ -256,3 +251,37 @@ func musllinuxTags(arch string, major, minor int) []string { } return out } + +// macosBinaryFormats is the ordered list of binary-format suffixes a macOS +// architecture's tags may claim (per pypa/packaging's _mac_binary_formats, +// restricted to the archs this package supports). "intel"/"fat64"/"fat32" +// are legacy 32/64-bit-Intel umbrella formats that only ever applied to +// x86_64 (and, pre-Intel-64, i386/ppc, which are out of scope here); +// "universal"/"universal2" are fat binaries spanning multiple architectures. +var macosBinaryFormats = map[string][]string{ + "x86_64": {"x86_64", "intel", "fat64", "fat32", "universal2", "universal"}, + "arm64": {"arm64", "universal2"}, +} + +// macosPlatformTags returns the ordered platform-tag list for a macOS +// Target: "macosx__0_" for every major version M from the target's +// declared major version down to 11 (inclusive), newest first, each paired +// with every binary format the architecture supports. Only macOS 11+ is +// supported (Global Constraints: "macOS: 11+ only" -- pre-11's yearly +// major-version-10 minor-bump numbering, and pypa/packaging's compatibility +// tail of pre-11 "macosx_10__universal2" fallbacks, are both deferred). +func macosPlatformTags(arch string, major int) []string { + formats, ok := macosBinaryFormats[arch] + if !ok { + // Unreachable: Target.validate restricts macOS Arch to macosArchs, + // and every entry there has a macosBinaryFormats list. + panic("tags: no binary formats for macOS arch " + arch) + } + out := make([]string, 0, (major-11+1)*len(formats)) + for m := major; m >= 11; m-- { + for _, f := range formats { + out = append(out, fmt.Sprintf("macosx_%d_0_%s", m, f)) + } + } + return out +} diff --git a/tags/golden_test.go b/tags/golden_test.go index a52c0a9..95c2f41 100644 --- a/tags/golden_test.go +++ b/tags/golden_test.go @@ -13,7 +13,7 @@ import ( // goldenTargets maps a testdata/*.json fixture base name to the Target that // produced it. Fixtures are generated by tags/testdata/gen_goldens.py from // the reference Python "packaging" library; see that script for exact -// generation parameters. Task 4 adds the macOS entries. +// generation parameters. var goldenTargets = map[string]Target{ "windows-amd64.json": {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "windows", Arch: "amd64"}, "generic-py3.json": {Implementation: "py", PyMajor: 3, PyMinor: 11, OS: "windows", Arch: "amd64"}, @@ -29,6 +29,14 @@ var goldenTargets = map[string]Target{ Implementation: "cp", PyMajor: 3, PyMinor: 12, OS: "linux", Arch: "x86_64", Libc: "musl", LibcMajor: 1, LibcMinor: 2, }, + "cp310_macos12_arm64.json": { + Implementation: "cp", PyMajor: 3, PyMinor: 10, OS: "macos", Arch: "arm64", + MacMajor: 12, MacMinor: 0, + }, + "cp312_macos14_x86_64.json": { + Implementation: "cp", PyMajor: 3, PyMinor: 12, OS: "macos", Arch: "x86_64", + MacMajor: 14, MacMinor: 0, + }, } // TestGolden asserts that Target.Compile().Tags(), stringified in order, diff --git a/tags/target.go b/tags/target.go index 01575bd..db13b7d 100644 --- a/tags/target.go +++ b/tags/target.go @@ -35,7 +35,10 @@ type Target struct { LibcMinor int // MacMajor and MacMinor are required when OS == "macos". Only macOS 11 - // and later is supported. + // and later is supported. Generated tags always use "_0" (macOS + // 11+ yearly releases only bump the major version), so MacMinor does not + // affect the generated tag set; it is validated (must be >= 0) for + // forward compatibility and symmetry with PyMinor/LibcMinor. MacMajor int MacMinor int } @@ -91,6 +94,9 @@ func (t Target) validate() error { if t.MacMajor < 11 { return fmt.Errorf("%w: macOS target requires major version >= 11, got %d", ErrUnsupportedTarget, t.MacMajor) } + if t.MacMinor < 0 { + return fmt.Errorf("%w: invalid macOS minor version %d", ErrUnsupportedTarget, t.MacMinor) + } case "windows": if !contains(windowsArchs, t.Arch) { return fmt.Errorf("%w: unsupported windows arch %q", ErrUnsupportedTarget, t.Arch) diff --git a/tags/target_test.go b/tags/target_test.go index 8e2da50..c05215c 100644 --- a/tags/target_test.go +++ b/tags/target_test.go @@ -15,6 +15,7 @@ func TestCompile_RejectsUnsupported(t *testing.T) { {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "macos", Arch: "arm64", MacMajor: 10, MacMinor: 15}, // <11 {Implementation: "cp", PyMajor: 3, PyMinor: -1, OS: "linux", Arch: "x86_64", Libc: "glibc", LibcMajor: 2, LibcMinor: 28}, // invalid PyMinor, must error not panic {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "linux", Arch: "x86_64", Libc: "musl", LibcMajor: 1, LibcMinor: -2}, // invalid negative LibcMinor, must error not panic + {Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "macos", Arch: "arm64", MacMajor: 12, MacMinor: -1}, // invalid negative MacMinor, must error not panic } { _, err := tg.Compile() require.Error(t, err) @@ -60,6 +61,35 @@ func TestLinux_BareLinuxRankedLast(t *testing.T) { assert.Less(t, rMany, rBare) } +// TestMacOS_ArchFormats exercises the arch-dependent macOS binary-format +// list (see Global Constraints): arm64 only ever claims "arm64"/"universal2" +// (no legacy Intel formats), x86_64 claims the full legacy format list, and +// both stop walking major versions at 11 (macOS 11+ only). +func TestMacOS_ArchFormats(t *testing.T) { + mArm, err := Target{Implementation: "cp", PyMajor: 3, PyMinor: 10, OS: "macos", Arch: "arm64", MacMajor: 12, MacMinor: 0}.Compile() + require.NoError(t, err) + ss := tagStrings(mArm.Tags()) + assert.Contains(t, ss, "cp310-cp310-macosx_12_0_arm64") + assert.Contains(t, ss, "cp310-cp310-macosx_12_0_universal2") + assert.Contains(t, ss, "cp310-cp310-macosx_11_0_arm64") + for _, s := range ss { + assert.NotContains(t, s, "_intel") + assert.NotContains(t, s, "_fat") + assert.NotContains(t, s, "macosx_10_") + } + + mX, err := Target{Implementation: "cp", PyMajor: 3, PyMinor: 12, OS: "macos", Arch: "x86_64", MacMajor: 14, MacMinor: 0}.Compile() + require.NoError(t, err) + xs := tagStrings(mX.Tags()) + for _, fmtSuffix := range []string{"x86_64", "intel", "fat64", "fat32", "universal2", "universal"} { + assert.Contains(t, xs, "cp312-cp312-macosx_14_0_"+fmtSuffix) + assert.Contains(t, xs, "cp312-cp312-macosx_11_0_"+fmtSuffix) + } + for _, s := range xs { + assert.NotContains(t, s, "macosx_10_") + } +} + func TestMatcher_RankPrefersMoreSpecific(t *testing.T) { m, err := Target{Implementation: "cp", PyMajor: 3, PyMinor: 11, OS: "windows", Arch: "amd64"}.Compile() require.NoError(t, err) diff --git a/tags/testdata/cp310_macos12_arm64.json b/tags/testdata/cp310_macos12_arm64.json new file mode 100644 index 0000000..76e53e0 --- /dev/null +++ b/tags/testdata/cp310_macos12_arm64.json @@ -0,0 +1,107 @@ +[ + "cp310-cp310-macosx_12_0_arm64", + "cp310-cp310-macosx_12_0_universal2", + "cp310-cp310-macosx_11_0_arm64", + "cp310-cp310-macosx_11_0_universal2", + "cp310-abi3-macosx_12_0_arm64", + "cp310-abi3-macosx_12_0_universal2", + "cp310-abi3-macosx_11_0_arm64", + "cp310-abi3-macosx_11_0_universal2", + "cp310-none-macosx_12_0_arm64", + "cp310-none-macosx_12_0_universal2", + "cp310-none-macosx_11_0_arm64", + "cp310-none-macosx_11_0_universal2", + "cp39-abi3-macosx_12_0_arm64", + "cp39-abi3-macosx_12_0_universal2", + "cp39-abi3-macosx_11_0_arm64", + "cp39-abi3-macosx_11_0_universal2", + "cp38-abi3-macosx_12_0_arm64", + "cp38-abi3-macosx_12_0_universal2", + "cp38-abi3-macosx_11_0_arm64", + "cp38-abi3-macosx_11_0_universal2", + "cp37-abi3-macosx_12_0_arm64", + "cp37-abi3-macosx_12_0_universal2", + "cp37-abi3-macosx_11_0_arm64", + "cp37-abi3-macosx_11_0_universal2", + "cp36-abi3-macosx_12_0_arm64", + "cp36-abi3-macosx_12_0_universal2", + "cp36-abi3-macosx_11_0_arm64", + "cp36-abi3-macosx_11_0_universal2", + "cp35-abi3-macosx_12_0_arm64", + "cp35-abi3-macosx_12_0_universal2", + "cp35-abi3-macosx_11_0_arm64", + "cp35-abi3-macosx_11_0_universal2", + "cp34-abi3-macosx_12_0_arm64", + "cp34-abi3-macosx_12_0_universal2", + "cp34-abi3-macosx_11_0_arm64", + "cp34-abi3-macosx_11_0_universal2", + "cp33-abi3-macosx_12_0_arm64", + "cp33-abi3-macosx_12_0_universal2", + "cp33-abi3-macosx_11_0_arm64", + "cp33-abi3-macosx_11_0_universal2", + "cp32-abi3-macosx_12_0_arm64", + "cp32-abi3-macosx_12_0_universal2", + "cp32-abi3-macosx_11_0_arm64", + "cp32-abi3-macosx_11_0_universal2", + "py310-none-macosx_12_0_arm64", + "py310-none-macosx_12_0_universal2", + "py310-none-macosx_11_0_arm64", + "py310-none-macosx_11_0_universal2", + "py3-none-macosx_12_0_arm64", + "py3-none-macosx_12_0_universal2", + "py3-none-macosx_11_0_arm64", + "py3-none-macosx_11_0_universal2", + "py39-none-macosx_12_0_arm64", + "py39-none-macosx_12_0_universal2", + "py39-none-macosx_11_0_arm64", + "py39-none-macosx_11_0_universal2", + "py38-none-macosx_12_0_arm64", + "py38-none-macosx_12_0_universal2", + "py38-none-macosx_11_0_arm64", + "py38-none-macosx_11_0_universal2", + "py37-none-macosx_12_0_arm64", + "py37-none-macosx_12_0_universal2", + "py37-none-macosx_11_0_arm64", + "py37-none-macosx_11_0_universal2", + "py36-none-macosx_12_0_arm64", + "py36-none-macosx_12_0_universal2", + "py36-none-macosx_11_0_arm64", + "py36-none-macosx_11_0_universal2", + "py35-none-macosx_12_0_arm64", + "py35-none-macosx_12_0_universal2", + "py35-none-macosx_11_0_arm64", + "py35-none-macosx_11_0_universal2", + "py34-none-macosx_12_0_arm64", + "py34-none-macosx_12_0_universal2", + "py34-none-macosx_11_0_arm64", + "py34-none-macosx_11_0_universal2", + "py33-none-macosx_12_0_arm64", + "py33-none-macosx_12_0_universal2", + "py33-none-macosx_11_0_arm64", + "py33-none-macosx_11_0_universal2", + "py32-none-macosx_12_0_arm64", + "py32-none-macosx_12_0_universal2", + "py32-none-macosx_11_0_arm64", + "py32-none-macosx_11_0_universal2", + "py31-none-macosx_12_0_arm64", + "py31-none-macosx_12_0_universal2", + "py31-none-macosx_11_0_arm64", + "py31-none-macosx_11_0_universal2", + "py30-none-macosx_12_0_arm64", + "py30-none-macosx_12_0_universal2", + "py30-none-macosx_11_0_arm64", + "py30-none-macosx_11_0_universal2", + "cp310-none-any", + "py310-none-any", + "py3-none-any", + "py39-none-any", + "py38-none-any", + "py37-none-any", + "py36-none-any", + "py35-none-any", + "py34-none-any", + "py33-none-any", + "py32-none-any", + "py31-none-any", + "py30-none-any" +] diff --git a/tags/testdata/cp312_macos14_x86_64.json b/tags/testdata/cp312_macos14_x86_64.json new file mode 100644 index 0000000..9b60865 --- /dev/null +++ b/tags/testdata/cp312_macos14_x86_64.json @@ -0,0 +1,665 @@ +[ + "cp312-cp312-macosx_14_0_x86_64", + "cp312-cp312-macosx_14_0_intel", + "cp312-cp312-macosx_14_0_fat64", + "cp312-cp312-macosx_14_0_fat32", + "cp312-cp312-macosx_14_0_universal2", + "cp312-cp312-macosx_14_0_universal", + "cp312-cp312-macosx_13_0_x86_64", + "cp312-cp312-macosx_13_0_intel", + "cp312-cp312-macosx_13_0_fat64", + "cp312-cp312-macosx_13_0_fat32", + "cp312-cp312-macosx_13_0_universal2", + "cp312-cp312-macosx_13_0_universal", + "cp312-cp312-macosx_12_0_x86_64", + "cp312-cp312-macosx_12_0_intel", + "cp312-cp312-macosx_12_0_fat64", + "cp312-cp312-macosx_12_0_fat32", + "cp312-cp312-macosx_12_0_universal2", + "cp312-cp312-macosx_12_0_universal", + "cp312-cp312-macosx_11_0_x86_64", + "cp312-cp312-macosx_11_0_intel", + "cp312-cp312-macosx_11_0_fat64", + "cp312-cp312-macosx_11_0_fat32", + "cp312-cp312-macosx_11_0_universal2", + "cp312-cp312-macosx_11_0_universal", + "cp312-abi3-macosx_14_0_x86_64", + "cp312-abi3-macosx_14_0_intel", + "cp312-abi3-macosx_14_0_fat64", + "cp312-abi3-macosx_14_0_fat32", + "cp312-abi3-macosx_14_0_universal2", + "cp312-abi3-macosx_14_0_universal", + "cp312-abi3-macosx_13_0_x86_64", + "cp312-abi3-macosx_13_0_intel", + "cp312-abi3-macosx_13_0_fat64", + "cp312-abi3-macosx_13_0_fat32", + "cp312-abi3-macosx_13_0_universal2", + "cp312-abi3-macosx_13_0_universal", + "cp312-abi3-macosx_12_0_x86_64", + "cp312-abi3-macosx_12_0_intel", + "cp312-abi3-macosx_12_0_fat64", + "cp312-abi3-macosx_12_0_fat32", + "cp312-abi3-macosx_12_0_universal2", + "cp312-abi3-macosx_12_0_universal", + "cp312-abi3-macosx_11_0_x86_64", + "cp312-abi3-macosx_11_0_intel", + "cp312-abi3-macosx_11_0_fat64", + "cp312-abi3-macosx_11_0_fat32", + "cp312-abi3-macosx_11_0_universal2", + "cp312-abi3-macosx_11_0_universal", + "cp312-none-macosx_14_0_x86_64", + "cp312-none-macosx_14_0_intel", + "cp312-none-macosx_14_0_fat64", + "cp312-none-macosx_14_0_fat32", + "cp312-none-macosx_14_0_universal2", + "cp312-none-macosx_14_0_universal", + "cp312-none-macosx_13_0_x86_64", + "cp312-none-macosx_13_0_intel", + "cp312-none-macosx_13_0_fat64", + "cp312-none-macosx_13_0_fat32", + "cp312-none-macosx_13_0_universal2", + "cp312-none-macosx_13_0_universal", + "cp312-none-macosx_12_0_x86_64", + "cp312-none-macosx_12_0_intel", + "cp312-none-macosx_12_0_fat64", + "cp312-none-macosx_12_0_fat32", + "cp312-none-macosx_12_0_universal2", + "cp312-none-macosx_12_0_universal", + "cp312-none-macosx_11_0_x86_64", + "cp312-none-macosx_11_0_intel", + "cp312-none-macosx_11_0_fat64", + "cp312-none-macosx_11_0_fat32", + "cp312-none-macosx_11_0_universal2", + "cp312-none-macosx_11_0_universal", + "cp311-abi3-macosx_14_0_x86_64", + "cp311-abi3-macosx_14_0_intel", + "cp311-abi3-macosx_14_0_fat64", + "cp311-abi3-macosx_14_0_fat32", + "cp311-abi3-macosx_14_0_universal2", + "cp311-abi3-macosx_14_0_universal", + "cp311-abi3-macosx_13_0_x86_64", + "cp311-abi3-macosx_13_0_intel", + "cp311-abi3-macosx_13_0_fat64", + "cp311-abi3-macosx_13_0_fat32", + "cp311-abi3-macosx_13_0_universal2", + "cp311-abi3-macosx_13_0_universal", + "cp311-abi3-macosx_12_0_x86_64", + "cp311-abi3-macosx_12_0_intel", + "cp311-abi3-macosx_12_0_fat64", + "cp311-abi3-macosx_12_0_fat32", + "cp311-abi3-macosx_12_0_universal2", + "cp311-abi3-macosx_12_0_universal", + "cp311-abi3-macosx_11_0_x86_64", + "cp311-abi3-macosx_11_0_intel", + "cp311-abi3-macosx_11_0_fat64", + "cp311-abi3-macosx_11_0_fat32", + "cp311-abi3-macosx_11_0_universal2", + "cp311-abi3-macosx_11_0_universal", + "cp310-abi3-macosx_14_0_x86_64", + "cp310-abi3-macosx_14_0_intel", + "cp310-abi3-macosx_14_0_fat64", + "cp310-abi3-macosx_14_0_fat32", + "cp310-abi3-macosx_14_0_universal2", + "cp310-abi3-macosx_14_0_universal", + "cp310-abi3-macosx_13_0_x86_64", + "cp310-abi3-macosx_13_0_intel", + "cp310-abi3-macosx_13_0_fat64", + "cp310-abi3-macosx_13_0_fat32", + "cp310-abi3-macosx_13_0_universal2", + "cp310-abi3-macosx_13_0_universal", + "cp310-abi3-macosx_12_0_x86_64", + "cp310-abi3-macosx_12_0_intel", + "cp310-abi3-macosx_12_0_fat64", + "cp310-abi3-macosx_12_0_fat32", + "cp310-abi3-macosx_12_0_universal2", + "cp310-abi3-macosx_12_0_universal", + "cp310-abi3-macosx_11_0_x86_64", + "cp310-abi3-macosx_11_0_intel", + "cp310-abi3-macosx_11_0_fat64", + "cp310-abi3-macosx_11_0_fat32", + "cp310-abi3-macosx_11_0_universal2", + "cp310-abi3-macosx_11_0_universal", + "cp39-abi3-macosx_14_0_x86_64", + "cp39-abi3-macosx_14_0_intel", + "cp39-abi3-macosx_14_0_fat64", + "cp39-abi3-macosx_14_0_fat32", + "cp39-abi3-macosx_14_0_universal2", + "cp39-abi3-macosx_14_0_universal", + "cp39-abi3-macosx_13_0_x86_64", + "cp39-abi3-macosx_13_0_intel", + "cp39-abi3-macosx_13_0_fat64", + "cp39-abi3-macosx_13_0_fat32", + "cp39-abi3-macosx_13_0_universal2", + "cp39-abi3-macosx_13_0_universal", + "cp39-abi3-macosx_12_0_x86_64", + "cp39-abi3-macosx_12_0_intel", + "cp39-abi3-macosx_12_0_fat64", + "cp39-abi3-macosx_12_0_fat32", + "cp39-abi3-macosx_12_0_universal2", + "cp39-abi3-macosx_12_0_universal", + "cp39-abi3-macosx_11_0_x86_64", + "cp39-abi3-macosx_11_0_intel", + "cp39-abi3-macosx_11_0_fat64", + "cp39-abi3-macosx_11_0_fat32", + "cp39-abi3-macosx_11_0_universal2", + "cp39-abi3-macosx_11_0_universal", + "cp38-abi3-macosx_14_0_x86_64", + "cp38-abi3-macosx_14_0_intel", + "cp38-abi3-macosx_14_0_fat64", + "cp38-abi3-macosx_14_0_fat32", + "cp38-abi3-macosx_14_0_universal2", + "cp38-abi3-macosx_14_0_universal", + "cp38-abi3-macosx_13_0_x86_64", + "cp38-abi3-macosx_13_0_intel", + "cp38-abi3-macosx_13_0_fat64", + "cp38-abi3-macosx_13_0_fat32", + "cp38-abi3-macosx_13_0_universal2", + "cp38-abi3-macosx_13_0_universal", + "cp38-abi3-macosx_12_0_x86_64", + "cp38-abi3-macosx_12_0_intel", + "cp38-abi3-macosx_12_0_fat64", + "cp38-abi3-macosx_12_0_fat32", + "cp38-abi3-macosx_12_0_universal2", + "cp38-abi3-macosx_12_0_universal", + "cp38-abi3-macosx_11_0_x86_64", + "cp38-abi3-macosx_11_0_intel", + "cp38-abi3-macosx_11_0_fat64", + "cp38-abi3-macosx_11_0_fat32", + "cp38-abi3-macosx_11_0_universal2", + "cp38-abi3-macosx_11_0_universal", + "cp37-abi3-macosx_14_0_x86_64", + "cp37-abi3-macosx_14_0_intel", + "cp37-abi3-macosx_14_0_fat64", + "cp37-abi3-macosx_14_0_fat32", + "cp37-abi3-macosx_14_0_universal2", + "cp37-abi3-macosx_14_0_universal", + "cp37-abi3-macosx_13_0_x86_64", + "cp37-abi3-macosx_13_0_intel", + "cp37-abi3-macosx_13_0_fat64", + "cp37-abi3-macosx_13_0_fat32", + "cp37-abi3-macosx_13_0_universal2", + "cp37-abi3-macosx_13_0_universal", + "cp37-abi3-macosx_12_0_x86_64", + "cp37-abi3-macosx_12_0_intel", + "cp37-abi3-macosx_12_0_fat64", + "cp37-abi3-macosx_12_0_fat32", + "cp37-abi3-macosx_12_0_universal2", + "cp37-abi3-macosx_12_0_universal", + "cp37-abi3-macosx_11_0_x86_64", + "cp37-abi3-macosx_11_0_intel", + "cp37-abi3-macosx_11_0_fat64", + "cp37-abi3-macosx_11_0_fat32", + "cp37-abi3-macosx_11_0_universal2", + "cp37-abi3-macosx_11_0_universal", + "cp36-abi3-macosx_14_0_x86_64", + "cp36-abi3-macosx_14_0_intel", + "cp36-abi3-macosx_14_0_fat64", + "cp36-abi3-macosx_14_0_fat32", + "cp36-abi3-macosx_14_0_universal2", + "cp36-abi3-macosx_14_0_universal", + "cp36-abi3-macosx_13_0_x86_64", + "cp36-abi3-macosx_13_0_intel", + "cp36-abi3-macosx_13_0_fat64", + "cp36-abi3-macosx_13_0_fat32", + "cp36-abi3-macosx_13_0_universal2", + "cp36-abi3-macosx_13_0_universal", + "cp36-abi3-macosx_12_0_x86_64", + "cp36-abi3-macosx_12_0_intel", + "cp36-abi3-macosx_12_0_fat64", + "cp36-abi3-macosx_12_0_fat32", + "cp36-abi3-macosx_12_0_universal2", + "cp36-abi3-macosx_12_0_universal", + "cp36-abi3-macosx_11_0_x86_64", + "cp36-abi3-macosx_11_0_intel", + "cp36-abi3-macosx_11_0_fat64", + "cp36-abi3-macosx_11_0_fat32", + "cp36-abi3-macosx_11_0_universal2", + "cp36-abi3-macosx_11_0_universal", + "cp35-abi3-macosx_14_0_x86_64", + "cp35-abi3-macosx_14_0_intel", + "cp35-abi3-macosx_14_0_fat64", + "cp35-abi3-macosx_14_0_fat32", + "cp35-abi3-macosx_14_0_universal2", + "cp35-abi3-macosx_14_0_universal", + "cp35-abi3-macosx_13_0_x86_64", + "cp35-abi3-macosx_13_0_intel", + "cp35-abi3-macosx_13_0_fat64", + "cp35-abi3-macosx_13_0_fat32", + "cp35-abi3-macosx_13_0_universal2", + "cp35-abi3-macosx_13_0_universal", + "cp35-abi3-macosx_12_0_x86_64", + "cp35-abi3-macosx_12_0_intel", + "cp35-abi3-macosx_12_0_fat64", + "cp35-abi3-macosx_12_0_fat32", + "cp35-abi3-macosx_12_0_universal2", + "cp35-abi3-macosx_12_0_universal", + "cp35-abi3-macosx_11_0_x86_64", + "cp35-abi3-macosx_11_0_intel", + "cp35-abi3-macosx_11_0_fat64", + "cp35-abi3-macosx_11_0_fat32", + "cp35-abi3-macosx_11_0_universal2", + "cp35-abi3-macosx_11_0_universal", + "cp34-abi3-macosx_14_0_x86_64", + "cp34-abi3-macosx_14_0_intel", + "cp34-abi3-macosx_14_0_fat64", + "cp34-abi3-macosx_14_0_fat32", + "cp34-abi3-macosx_14_0_universal2", + "cp34-abi3-macosx_14_0_universal", + "cp34-abi3-macosx_13_0_x86_64", + "cp34-abi3-macosx_13_0_intel", + "cp34-abi3-macosx_13_0_fat64", + "cp34-abi3-macosx_13_0_fat32", + "cp34-abi3-macosx_13_0_universal2", + "cp34-abi3-macosx_13_0_universal", + "cp34-abi3-macosx_12_0_x86_64", + "cp34-abi3-macosx_12_0_intel", + "cp34-abi3-macosx_12_0_fat64", + "cp34-abi3-macosx_12_0_fat32", + "cp34-abi3-macosx_12_0_universal2", + "cp34-abi3-macosx_12_0_universal", + "cp34-abi3-macosx_11_0_x86_64", + "cp34-abi3-macosx_11_0_intel", + "cp34-abi3-macosx_11_0_fat64", + "cp34-abi3-macosx_11_0_fat32", + "cp34-abi3-macosx_11_0_universal2", + "cp34-abi3-macosx_11_0_universal", + "cp33-abi3-macosx_14_0_x86_64", + "cp33-abi3-macosx_14_0_intel", + "cp33-abi3-macosx_14_0_fat64", + "cp33-abi3-macosx_14_0_fat32", + "cp33-abi3-macosx_14_0_universal2", + "cp33-abi3-macosx_14_0_universal", + "cp33-abi3-macosx_13_0_x86_64", + "cp33-abi3-macosx_13_0_intel", + "cp33-abi3-macosx_13_0_fat64", + "cp33-abi3-macosx_13_0_fat32", + "cp33-abi3-macosx_13_0_universal2", + "cp33-abi3-macosx_13_0_universal", + "cp33-abi3-macosx_12_0_x86_64", + "cp33-abi3-macosx_12_0_intel", + "cp33-abi3-macosx_12_0_fat64", + "cp33-abi3-macosx_12_0_fat32", + "cp33-abi3-macosx_12_0_universal2", + "cp33-abi3-macosx_12_0_universal", + "cp33-abi3-macosx_11_0_x86_64", + "cp33-abi3-macosx_11_0_intel", + "cp33-abi3-macosx_11_0_fat64", + "cp33-abi3-macosx_11_0_fat32", + "cp33-abi3-macosx_11_0_universal2", + "cp33-abi3-macosx_11_0_universal", + "cp32-abi3-macosx_14_0_x86_64", + "cp32-abi3-macosx_14_0_intel", + "cp32-abi3-macosx_14_0_fat64", + "cp32-abi3-macosx_14_0_fat32", + "cp32-abi3-macosx_14_0_universal2", + "cp32-abi3-macosx_14_0_universal", + "cp32-abi3-macosx_13_0_x86_64", + "cp32-abi3-macosx_13_0_intel", + "cp32-abi3-macosx_13_0_fat64", + "cp32-abi3-macosx_13_0_fat32", + "cp32-abi3-macosx_13_0_universal2", + "cp32-abi3-macosx_13_0_universal", + "cp32-abi3-macosx_12_0_x86_64", + "cp32-abi3-macosx_12_0_intel", + "cp32-abi3-macosx_12_0_fat64", + "cp32-abi3-macosx_12_0_fat32", + "cp32-abi3-macosx_12_0_universal2", + "cp32-abi3-macosx_12_0_universal", + "cp32-abi3-macosx_11_0_x86_64", + "cp32-abi3-macosx_11_0_intel", + "cp32-abi3-macosx_11_0_fat64", + "cp32-abi3-macosx_11_0_fat32", + "cp32-abi3-macosx_11_0_universal2", + "cp32-abi3-macosx_11_0_universal", + "py312-none-macosx_14_0_x86_64", + "py312-none-macosx_14_0_intel", + "py312-none-macosx_14_0_fat64", + "py312-none-macosx_14_0_fat32", + "py312-none-macosx_14_0_universal2", + "py312-none-macosx_14_0_universal", + "py312-none-macosx_13_0_x86_64", + "py312-none-macosx_13_0_intel", + "py312-none-macosx_13_0_fat64", + "py312-none-macosx_13_0_fat32", + "py312-none-macosx_13_0_universal2", + "py312-none-macosx_13_0_universal", + "py312-none-macosx_12_0_x86_64", + "py312-none-macosx_12_0_intel", + "py312-none-macosx_12_0_fat64", + "py312-none-macosx_12_0_fat32", + "py312-none-macosx_12_0_universal2", + "py312-none-macosx_12_0_universal", + "py312-none-macosx_11_0_x86_64", + "py312-none-macosx_11_0_intel", + "py312-none-macosx_11_0_fat64", + "py312-none-macosx_11_0_fat32", + "py312-none-macosx_11_0_universal2", + "py312-none-macosx_11_0_universal", + "py3-none-macosx_14_0_x86_64", + "py3-none-macosx_14_0_intel", + "py3-none-macosx_14_0_fat64", + "py3-none-macosx_14_0_fat32", + "py3-none-macosx_14_0_universal2", + "py3-none-macosx_14_0_universal", + "py3-none-macosx_13_0_x86_64", + "py3-none-macosx_13_0_intel", + "py3-none-macosx_13_0_fat64", + "py3-none-macosx_13_0_fat32", + "py3-none-macosx_13_0_universal2", + "py3-none-macosx_13_0_universal", + "py3-none-macosx_12_0_x86_64", + "py3-none-macosx_12_0_intel", + "py3-none-macosx_12_0_fat64", + "py3-none-macosx_12_0_fat32", + "py3-none-macosx_12_0_universal2", + "py3-none-macosx_12_0_universal", + "py3-none-macosx_11_0_x86_64", + "py3-none-macosx_11_0_intel", + "py3-none-macosx_11_0_fat64", + "py3-none-macosx_11_0_fat32", + "py3-none-macosx_11_0_universal2", + "py3-none-macosx_11_0_universal", + "py311-none-macosx_14_0_x86_64", + "py311-none-macosx_14_0_intel", + "py311-none-macosx_14_0_fat64", + "py311-none-macosx_14_0_fat32", + "py311-none-macosx_14_0_universal2", + "py311-none-macosx_14_0_universal", + "py311-none-macosx_13_0_x86_64", + "py311-none-macosx_13_0_intel", + "py311-none-macosx_13_0_fat64", + "py311-none-macosx_13_0_fat32", + "py311-none-macosx_13_0_universal2", + "py311-none-macosx_13_0_universal", + "py311-none-macosx_12_0_x86_64", + "py311-none-macosx_12_0_intel", + "py311-none-macosx_12_0_fat64", + "py311-none-macosx_12_0_fat32", + "py311-none-macosx_12_0_universal2", + "py311-none-macosx_12_0_universal", + "py311-none-macosx_11_0_x86_64", + "py311-none-macosx_11_0_intel", + "py311-none-macosx_11_0_fat64", + "py311-none-macosx_11_0_fat32", + "py311-none-macosx_11_0_universal2", + "py311-none-macosx_11_0_universal", + "py310-none-macosx_14_0_x86_64", + "py310-none-macosx_14_0_intel", + "py310-none-macosx_14_0_fat64", + "py310-none-macosx_14_0_fat32", + "py310-none-macosx_14_0_universal2", + "py310-none-macosx_14_0_universal", + "py310-none-macosx_13_0_x86_64", + "py310-none-macosx_13_0_intel", + "py310-none-macosx_13_0_fat64", + "py310-none-macosx_13_0_fat32", + "py310-none-macosx_13_0_universal2", + "py310-none-macosx_13_0_universal", + "py310-none-macosx_12_0_x86_64", + "py310-none-macosx_12_0_intel", + "py310-none-macosx_12_0_fat64", + "py310-none-macosx_12_0_fat32", + "py310-none-macosx_12_0_universal2", + "py310-none-macosx_12_0_universal", + "py310-none-macosx_11_0_x86_64", + "py310-none-macosx_11_0_intel", + "py310-none-macosx_11_0_fat64", + "py310-none-macosx_11_0_fat32", + "py310-none-macosx_11_0_universal2", + "py310-none-macosx_11_0_universal", + "py39-none-macosx_14_0_x86_64", + "py39-none-macosx_14_0_intel", + "py39-none-macosx_14_0_fat64", + "py39-none-macosx_14_0_fat32", + "py39-none-macosx_14_0_universal2", + "py39-none-macosx_14_0_universal", + "py39-none-macosx_13_0_x86_64", + "py39-none-macosx_13_0_intel", + "py39-none-macosx_13_0_fat64", + "py39-none-macosx_13_0_fat32", + "py39-none-macosx_13_0_universal2", + "py39-none-macosx_13_0_universal", + "py39-none-macosx_12_0_x86_64", + "py39-none-macosx_12_0_intel", + "py39-none-macosx_12_0_fat64", + "py39-none-macosx_12_0_fat32", + "py39-none-macosx_12_0_universal2", + "py39-none-macosx_12_0_universal", + "py39-none-macosx_11_0_x86_64", + "py39-none-macosx_11_0_intel", + "py39-none-macosx_11_0_fat64", + "py39-none-macosx_11_0_fat32", + "py39-none-macosx_11_0_universal2", + "py39-none-macosx_11_0_universal", + "py38-none-macosx_14_0_x86_64", + "py38-none-macosx_14_0_intel", + "py38-none-macosx_14_0_fat64", + "py38-none-macosx_14_0_fat32", + "py38-none-macosx_14_0_universal2", + "py38-none-macosx_14_0_universal", + "py38-none-macosx_13_0_x86_64", + "py38-none-macosx_13_0_intel", + "py38-none-macosx_13_0_fat64", + "py38-none-macosx_13_0_fat32", + "py38-none-macosx_13_0_universal2", + "py38-none-macosx_13_0_universal", + "py38-none-macosx_12_0_x86_64", + "py38-none-macosx_12_0_intel", + "py38-none-macosx_12_0_fat64", + "py38-none-macosx_12_0_fat32", + "py38-none-macosx_12_0_universal2", + "py38-none-macosx_12_0_universal", + "py38-none-macosx_11_0_x86_64", + "py38-none-macosx_11_0_intel", + "py38-none-macosx_11_0_fat64", + "py38-none-macosx_11_0_fat32", + "py38-none-macosx_11_0_universal2", + "py38-none-macosx_11_0_universal", + "py37-none-macosx_14_0_x86_64", + "py37-none-macosx_14_0_intel", + "py37-none-macosx_14_0_fat64", + "py37-none-macosx_14_0_fat32", + "py37-none-macosx_14_0_universal2", + "py37-none-macosx_14_0_universal", + "py37-none-macosx_13_0_x86_64", + "py37-none-macosx_13_0_intel", + "py37-none-macosx_13_0_fat64", + "py37-none-macosx_13_0_fat32", + "py37-none-macosx_13_0_universal2", + "py37-none-macosx_13_0_universal", + "py37-none-macosx_12_0_x86_64", + "py37-none-macosx_12_0_intel", + "py37-none-macosx_12_0_fat64", + "py37-none-macosx_12_0_fat32", + "py37-none-macosx_12_0_universal2", + "py37-none-macosx_12_0_universal", + "py37-none-macosx_11_0_x86_64", + "py37-none-macosx_11_0_intel", + "py37-none-macosx_11_0_fat64", + "py37-none-macosx_11_0_fat32", + "py37-none-macosx_11_0_universal2", + "py37-none-macosx_11_0_universal", + "py36-none-macosx_14_0_x86_64", + "py36-none-macosx_14_0_intel", + "py36-none-macosx_14_0_fat64", + "py36-none-macosx_14_0_fat32", + "py36-none-macosx_14_0_universal2", + "py36-none-macosx_14_0_universal", + "py36-none-macosx_13_0_x86_64", + "py36-none-macosx_13_0_intel", + "py36-none-macosx_13_0_fat64", + "py36-none-macosx_13_0_fat32", + "py36-none-macosx_13_0_universal2", + "py36-none-macosx_13_0_universal", + "py36-none-macosx_12_0_x86_64", + "py36-none-macosx_12_0_intel", + "py36-none-macosx_12_0_fat64", + "py36-none-macosx_12_0_fat32", + "py36-none-macosx_12_0_universal2", + "py36-none-macosx_12_0_universal", + "py36-none-macosx_11_0_x86_64", + "py36-none-macosx_11_0_intel", + "py36-none-macosx_11_0_fat64", + "py36-none-macosx_11_0_fat32", + "py36-none-macosx_11_0_universal2", + "py36-none-macosx_11_0_universal", + "py35-none-macosx_14_0_x86_64", + "py35-none-macosx_14_0_intel", + "py35-none-macosx_14_0_fat64", + "py35-none-macosx_14_0_fat32", + "py35-none-macosx_14_0_universal2", + "py35-none-macosx_14_0_universal", + "py35-none-macosx_13_0_x86_64", + "py35-none-macosx_13_0_intel", + "py35-none-macosx_13_0_fat64", + "py35-none-macosx_13_0_fat32", + "py35-none-macosx_13_0_universal2", + "py35-none-macosx_13_0_universal", + "py35-none-macosx_12_0_x86_64", + "py35-none-macosx_12_0_intel", + "py35-none-macosx_12_0_fat64", + "py35-none-macosx_12_0_fat32", + "py35-none-macosx_12_0_universal2", + "py35-none-macosx_12_0_universal", + "py35-none-macosx_11_0_x86_64", + "py35-none-macosx_11_0_intel", + "py35-none-macosx_11_0_fat64", + "py35-none-macosx_11_0_fat32", + "py35-none-macosx_11_0_universal2", + "py35-none-macosx_11_0_universal", + "py34-none-macosx_14_0_x86_64", + "py34-none-macosx_14_0_intel", + "py34-none-macosx_14_0_fat64", + "py34-none-macosx_14_0_fat32", + "py34-none-macosx_14_0_universal2", + "py34-none-macosx_14_0_universal", + "py34-none-macosx_13_0_x86_64", + "py34-none-macosx_13_0_intel", + "py34-none-macosx_13_0_fat64", + "py34-none-macosx_13_0_fat32", + "py34-none-macosx_13_0_universal2", + "py34-none-macosx_13_0_universal", + "py34-none-macosx_12_0_x86_64", + "py34-none-macosx_12_0_intel", + "py34-none-macosx_12_0_fat64", + "py34-none-macosx_12_0_fat32", + "py34-none-macosx_12_0_universal2", + "py34-none-macosx_12_0_universal", + "py34-none-macosx_11_0_x86_64", + "py34-none-macosx_11_0_intel", + "py34-none-macosx_11_0_fat64", + "py34-none-macosx_11_0_fat32", + "py34-none-macosx_11_0_universal2", + "py34-none-macosx_11_0_universal", + "py33-none-macosx_14_0_x86_64", + "py33-none-macosx_14_0_intel", + "py33-none-macosx_14_0_fat64", + "py33-none-macosx_14_0_fat32", + "py33-none-macosx_14_0_universal2", + "py33-none-macosx_14_0_universal", + "py33-none-macosx_13_0_x86_64", + "py33-none-macosx_13_0_intel", + "py33-none-macosx_13_0_fat64", + "py33-none-macosx_13_0_fat32", + "py33-none-macosx_13_0_universal2", + "py33-none-macosx_13_0_universal", + "py33-none-macosx_12_0_x86_64", + "py33-none-macosx_12_0_intel", + "py33-none-macosx_12_0_fat64", + "py33-none-macosx_12_0_fat32", + "py33-none-macosx_12_0_universal2", + "py33-none-macosx_12_0_universal", + "py33-none-macosx_11_0_x86_64", + "py33-none-macosx_11_0_intel", + "py33-none-macosx_11_0_fat64", + "py33-none-macosx_11_0_fat32", + "py33-none-macosx_11_0_universal2", + "py33-none-macosx_11_0_universal", + "py32-none-macosx_14_0_x86_64", + "py32-none-macosx_14_0_intel", + "py32-none-macosx_14_0_fat64", + "py32-none-macosx_14_0_fat32", + "py32-none-macosx_14_0_universal2", + "py32-none-macosx_14_0_universal", + "py32-none-macosx_13_0_x86_64", + "py32-none-macosx_13_0_intel", + "py32-none-macosx_13_0_fat64", + "py32-none-macosx_13_0_fat32", + "py32-none-macosx_13_0_universal2", + "py32-none-macosx_13_0_universal", + "py32-none-macosx_12_0_x86_64", + "py32-none-macosx_12_0_intel", + "py32-none-macosx_12_0_fat64", + "py32-none-macosx_12_0_fat32", + "py32-none-macosx_12_0_universal2", + "py32-none-macosx_12_0_universal", + "py32-none-macosx_11_0_x86_64", + "py32-none-macosx_11_0_intel", + "py32-none-macosx_11_0_fat64", + "py32-none-macosx_11_0_fat32", + "py32-none-macosx_11_0_universal2", + "py32-none-macosx_11_0_universal", + "py31-none-macosx_14_0_x86_64", + "py31-none-macosx_14_0_intel", + "py31-none-macosx_14_0_fat64", + "py31-none-macosx_14_0_fat32", + "py31-none-macosx_14_0_universal2", + "py31-none-macosx_14_0_universal", + "py31-none-macosx_13_0_x86_64", + "py31-none-macosx_13_0_intel", + "py31-none-macosx_13_0_fat64", + "py31-none-macosx_13_0_fat32", + "py31-none-macosx_13_0_universal2", + "py31-none-macosx_13_0_universal", + "py31-none-macosx_12_0_x86_64", + "py31-none-macosx_12_0_intel", + "py31-none-macosx_12_0_fat64", + "py31-none-macosx_12_0_fat32", + "py31-none-macosx_12_0_universal2", + "py31-none-macosx_12_0_universal", + "py31-none-macosx_11_0_x86_64", + "py31-none-macosx_11_0_intel", + "py31-none-macosx_11_0_fat64", + "py31-none-macosx_11_0_fat32", + "py31-none-macosx_11_0_universal2", + "py31-none-macosx_11_0_universal", + "py30-none-macosx_14_0_x86_64", + "py30-none-macosx_14_0_intel", + "py30-none-macosx_14_0_fat64", + "py30-none-macosx_14_0_fat32", + "py30-none-macosx_14_0_universal2", + "py30-none-macosx_14_0_universal", + "py30-none-macosx_13_0_x86_64", + "py30-none-macosx_13_0_intel", + "py30-none-macosx_13_0_fat64", + "py30-none-macosx_13_0_fat32", + "py30-none-macosx_13_0_universal2", + "py30-none-macosx_13_0_universal", + "py30-none-macosx_12_0_x86_64", + "py30-none-macosx_12_0_intel", + "py30-none-macosx_12_0_fat64", + "py30-none-macosx_12_0_fat32", + "py30-none-macosx_12_0_universal2", + "py30-none-macosx_12_0_universal", + "py30-none-macosx_11_0_x86_64", + "py30-none-macosx_11_0_intel", + "py30-none-macosx_11_0_fat64", + "py30-none-macosx_11_0_fat32", + "py30-none-macosx_11_0_universal2", + "py30-none-macosx_11_0_universal", + "cp312-none-any", + "py312-none-any", + "py3-none-any", + "py311-none-any", + "py310-none-any", + "py39-none-any", + "py38-none-any", + "py37-none-any", + "py36-none-any", + "py35-none-any", + "py34-none-any", + "py33-none-any", + "py32-none-any", + "py31-none-any", + "py30-none-any" +] diff --git a/tags/testdata/gen_goldens.py b/tags/testdata/gen_goldens.py index 6156b4a..153d5f1 100644 --- a/tags/testdata/gen_goldens.py +++ b/tags/testdata/gen_goldens.py @@ -112,4 +112,34 @@ def write_linux(name, python_version, interpreter, arch, libc, libc_major, libc_ # tags at all (this target has no glibc). write_linux("cp312_musl12_x86_64.json", (3, 12), "cp312", "x86_64", "musl", 1, 2) -# macOS targets (11+) are added in #18632 Task 4. +# --- macOS targets: 11+ only ------------------------------------------------ +# +# packaging.tags.mac_platforms((major, 0), arch) is directly parameterized by +# declared (major, minor) and arch -- no host-detection monkeypatching needed, +# unlike linux. It also yields a legacy compatibility tail of pre-11 +# "macosx_10__" tags (each yearly macOS release prior to 11 bumped +# the minor version under major 10); per Global Constraints ("macOS: 11+ +# only ... Pre-11 deferred") we deliberately drop that tail here so the +# golden fixture reflects our supported range, not packaging's full range. +def _mac_platform_list(major, arch): + platforms = list(T.mac_platforms((major, 0), arch)) + return [p for p in platforms if not p.startswith("macosx_10_")] + + +def write_macos(name, python_version, interpreter, major, arch): + platforms = _mac_platform_list(major, arch) + write( + name, + list(T.cpython_tags(python_version=python_version, abis=[interpreter], platforms=platforms)) + + list(T.compatible_tags(python_version=python_version, interpreter=interpreter, platforms=platforms)), + ) + + +# cp310, macOS 12, arm64: format walk stops at macosx_12_0/macosx_11_0, each +# with just [arm64, universal2] -- arm64 has no intel/fat* legacy formats. +write_macos("cp310_macos12_arm64.json", (3, 10), "cp310", 12, "arm64") + +# cp312, macOS 14, x86_64: full x86_64 format list +# ([x86_64, intel, fat64, fat32, universal2, universal]) at each of +# macosx_14_0/13_0/12_0/11_0. +write_macos("cp312_macos14_x86_64.json", (3, 12), "cp312", 14, "x86_64") From b0bef2dd31e118f3d72788636be73cb62728dba6 Mon Sep 17 00:00:00 2001 From: Jonathan Yoder Date: Wed, 8 Jul 2026 14:22:57 -0400 Subject: [PATCH 7/8] docs(tags): attribution + package docs (#18632) --- NOTICE | 8 ++++++++ README.md | 2 +- tags/doc.go | 9 ++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index 3c1766a..fed3c72 100644 --- a/NOTICE +++ b/NOTICE @@ -17,3 +17,11 @@ licensed under the Apache License, Version 2.0. The distribution/ package is ported from rstudio/python-distribution-parser (https://github.com/rstudio/python-distribution-parser), Copyright (c) 2024 Posit Software, PBC, originally MIT-licensed. + +The tags/ package adapts platform-compatibility-tag algorithms (manylinux and +musllinux glibc/musl floor tables, macOS format lists, tag ordering) from +pypa/packaging (https://github.com/pypa/packaging), specifically +packaging/tags.py, packaging/_manylinux.py, and packaging/_musllinux.py, +licensed under the Apache License, Version 2.0; and from Astral's uv +(https://github.com/astral-sh/uv), specifically the uv-platform-tags crate, +dual-licensed under the Apache License, Version 2.0, or the MIT license. diff --git a/README.md b/README.md index bfbb920..caa6a4f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Part of [RFD 0001 — Native Go PyPI Dependency Resolution](https://github.com/r | `reqtxt/` | pip `requirements.txt` format | | [`distribution/`](https://github.com/rstudio/python-distribution-parser) | METADATA / wheel parsing | | `wheelname/` | wheel filename → structured fields | -| `tags/` | PEP 425/600/656 compatibility tags | +| `tags/` | PEP 425/600/656 compatibility tags (server-side, target-parameterized; no host detection) | ## License diff --git a/tags/doc.go b/tags/doc.go index 817ad7e..c0a5bf9 100644 --- a/tags/doc.go +++ b/tags/doc.go @@ -3,5 +3,12 @@ // Package tags computes and matches platform-compatibility tags // (PEP 425 / 600 / 656). // -// TODO(#18632): implement compatibility-tag support. +// A Target describes a Python interpreter/platform combination and Compiles +// into a Matcher holding the ordered set of compatible tags for that target, +// plus a priority index for ranking candidate wheels. Generation is entirely +// server-side and parameterized by the given Target — there is no host +// detection. Notable divergences from CPython's packaging library: a bare +// linux_ tag is accepted but ranked last (below all manylinux and +// musllinux tags), and macOS targets are supported for version 11 and later +// only. package tags From 098e71ade82f38c3210f06ebfc5308ebc2737e20 Mon Sep 17 00:00:00 2001 From: Jonathan Yoder Date: Wed, 8 Jul 2026 14:52:56 -0400 Subject: [PATCH 8/8] refactor(tags): musl major guard, Tags() defensive copy, stronger ParseTag tests (#18632) --- tags/generate.go | 11 ++++++++++- tags/tag_test.go | 13 ++++++++++++- tags/target.go | 10 +++++++--- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/tags/generate.go b/tags/generate.go index 9446ece..4832c78 100644 --- a/tags/generate.go +++ b/tags/generate.go @@ -240,11 +240,20 @@ func manylinuxTags(arch string, major, minor int) []string { return out } +// musllinuxMajor is the only musl ABI major version musllinux tags are +// currently defined for (PEP 656); unlike manylinux/glibc, musl has not yet +// had an ABI-breaking major-version bump requiring a musllinux_2_* series. +const musllinuxMajor = 1 + // musllinuxTags returns "musllinux___" for every musl // version from the target's declared version down to musllinux__0, // newest first. Unlike manylinux there is no architecture-dependent floor or -// legacy alias. +// legacy alias. A target whose major doesn't match musllinuxMajor yields no +// musllinux tags, mirroring manylinuxTags' major-version guard. func musllinuxTags(arch string, major, minor int) []string { + if major != musllinuxMajor { + return nil + } out := make([]string, 0, minor+1) for m := minor; m >= 0; m-- { out = append(out, fmt.Sprintf("musllinux_%d_%d_%s", major, m, arch)) diff --git a/tags/tag_test.go b/tags/tag_test.go index 55b112d..4bd71e9 100644 --- a/tags/tag_test.go +++ b/tags/tag_test.go @@ -30,6 +30,17 @@ func TestParseTag_CartesianAllThreeFields(t *testing.T) { }, got) } +func TestParseTag_CartesianAllThreeFieldsMultiElementABI(t *testing.T) { + got, err := ParseTag("cp36.cp37-abi3.abi4-manylinux1_x86_64") + require.NoError(t, err) + assert.ElementsMatch(t, []Tag{ + {"cp36", "abi3", "manylinux1_x86_64"}, + {"cp36", "abi4", "manylinux1_x86_64"}, + {"cp37", "abi3", "manylinux1_x86_64"}, + {"cp37", "abi4", "manylinux1_x86_64"}, + }, got) +} + func TestParseTag_PurePython(t *testing.T) { got, err := ParseTag("py2.py3-none-any") require.NoError(t, err) @@ -37,7 +48,7 @@ func TestParseTag_PurePython(t *testing.T) { } func TestParseTag_Invalid(t *testing.T) { - for _, s := range []string{"cp311-cp311", "a-b-c-d", "cp311--any", "cp311-none-"} { + for _, s := range []string{"cp311-cp311", "a-b-c-d", "cp311--any", "cp311-none-", "cp36..cp37-abi3-any"} { _, err := ParseTag(s) require.Error(t, err, s) } diff --git a/tags/target.go b/tags/target.go index db13b7d..9b6fbf4 100644 --- a/tags/target.go +++ b/tags/target.go @@ -134,10 +134,14 @@ type Matcher struct { rank map[Tag]int } -// Tags returns the full ordered list of compatible tags, most preferred -// first. +// Tags returns a copy of the full ordered list of compatible tags, most +// preferred first. It is an inspection method, not the hot path (Rank and +// IsCompatible are); the copy protects the Matcher's internal slice from +// mutation by the caller. func (m *Matcher) Tags() []Tag { - return m.tags + out := make([]Tag, len(m.tags)) + copy(out, m.tags) + return out } // Rank reports the best (lowest, most preferred) priority among the given