Skip to content

Commit

Permalink
fix: infer tag could produce many/musl tags without repair/audit (#1438)
Browse files Browse the repository at this point in the history
Co-authored-by: Ofek Lev <[email protected]>
  • Loading branch information
henryiii and ofek authored Apr 29, 2024
1 parent 59f2b91 commit 20ca873
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/src/hatchling/builders/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,9 @@ def get_best_matching_tag(self) -> str:

from packaging.tags import sys_tags

tag = next(sys_tags())
# Linux tag is after many/musl; packaging tools are required to skip
# many/musl, see https://github.com/pypa/packaging/issues/160
tag = next(iter(t for t in sys_tags() if 'manylinux' not in t.platform and 'musllinux' not in t.platform))
tag_parts = [tag.interpreter, tag.abi, tag.platform]

archflags = os.environ.get('ARCHFLAGS', '')
Expand Down
4 changes: 4 additions & 0 deletions docs/history/hatchling.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

***Fixed:***

- Ignore `manylinux`/`musllinux` tags for the `wheel` target artifact name when enabling the `infer_tag` build data

## [1.24.2](https://github.com/pypa/hatch/releases/tag/hatchling-v1.24.2) - 2024-04-22 ## {: #hatchling-v1.24.2 }

***Fixed:***
Expand Down
9 changes: 8 additions & 1 deletion tests/backend/builders/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import zipfile
from typing import TYPE_CHECKING

import packaging.tags
import pytest
from packaging.tags import sys_tags

from hatchling.builders.plugin.interface import BuilderInterface
from hatchling.builders.utils import get_known_python_major_versions
Expand All @@ -18,6 +18,13 @@
if TYPE_CHECKING:
from hatch.utils.fs import Path


def sys_tags():
return iter(
t for t in packaging.tags.sys_tags() if 'manylinux' not in t.platform and 'muslllinux' not in t.platform
)


# https://github.com/python/cpython/pull/26184
fixed_pathlib_resolution = pytest.mark.skipif(
sys.platform == 'win32' and (sys.version_info < (3, 8) or sys.implementation.name == 'pypy'),
Expand Down

0 comments on commit 20ca873

Please sign in to comment.