Skip to content

Commit 8a241e4

Browse files
committed
fix: use manylinux tag for linux wheels
1 parent ccdf47a commit 8a241e4

4 files changed

Lines changed: 43 additions & 3 deletions

File tree

cppllvm_build.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
("Windows", "amd64"): ("windows-amd64", ".exe"),
3535
}
3636

37+
LINUX_WHEEL_PLATFORM_TAG = "manylinux_2_17_x86_64.manylinux2014_x86_64"
38+
3739

3840
@dataclass(frozen=True)
3941
class PackageBuildConfig:
@@ -120,6 +122,14 @@ def checksum_asset_name(config: PackageBuildConfig, stem: str) -> str:
120122
return f"{stem}-{llvm_major_version(config)}_{platform_name}.sha512sum"
121123

122124

125+
def wheel_platform_tag(default_platform_tag: str) -> str:
126+
host_system = system()
127+
host_machine = machine().lower()
128+
if host_system == "Linux" and host_machine in {"x86_64", "amd64"}:
129+
return LINUX_WHEEL_PLATFORM_TAG
130+
return default_platform_tag
131+
132+
123133
def cached_download(url: str, destination: Path, *, package_name: str) -> Path:
124134
if destination.exists() and destination.stat().st_size > 0:
125135
return destination
@@ -262,6 +272,6 @@ def finalize_options(self) -> None:
262272

263273
def get_tag(self) -> tuple[str, str, str]:
264274
_, _, platform_tag = super().get_tag()
265-
return "py3", "none", platform_tag
275+
return "py3", "none", wheel_platform_tag(platform_tag)
266276

267277
return build_py, bdist_wheel

packages/cformat/cppllvm_build.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
("Windows", "amd64"): ("windows-amd64", ".exe"),
3535
}
3636

37+
LINUX_WHEEL_PLATFORM_TAG = "manylinux_2_17_x86_64.manylinux2014_x86_64"
38+
3739

3840
@dataclass(frozen=True)
3941
class PackageBuildConfig:
@@ -120,6 +122,14 @@ def checksum_asset_name(config: PackageBuildConfig, stem: str) -> str:
120122
return f"{stem}-{llvm_major_version(config)}_{platform_name}.sha512sum"
121123

122124

125+
def wheel_platform_tag(default_platform_tag: str) -> str:
126+
host_system = system()
127+
host_machine = machine().lower()
128+
if host_system == "Linux" and host_machine in {"x86_64", "amd64"}:
129+
return LINUX_WHEEL_PLATFORM_TAG
130+
return default_platform_tag
131+
132+
123133
def cached_download(url: str, destination: Path, *, package_name: str) -> Path:
124134
if destination.exists() and destination.stat().st_size > 0:
125135
return destination
@@ -262,6 +272,6 @@ def finalize_options(self) -> None:
262272

263273
def get_tag(self) -> tuple[str, str, str]:
264274
_, _, platform_tag = super().get_tag()
265-
return "py3", "none", platform_tag
275+
return "py3", "none", wheel_platform_tag(platform_tag)
266276

267277
return build_py, bdist_wheel

packages/ctidy/cppllvm_build.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
("Windows", "amd64"): ("windows-amd64", ".exe"),
3535
}
3636

37+
LINUX_WHEEL_PLATFORM_TAG = "manylinux_2_17_x86_64.manylinux2014_x86_64"
38+
3739

3840
@dataclass(frozen=True)
3941
class PackageBuildConfig:
@@ -120,6 +122,14 @@ def checksum_asset_name(config: PackageBuildConfig, stem: str) -> str:
120122
return f"{stem}-{llvm_major_version(config)}_{platform_name}.sha512sum"
121123

122124

125+
def wheel_platform_tag(default_platform_tag: str) -> str:
126+
host_system = system()
127+
host_machine = machine().lower()
128+
if host_system == "Linux" and host_machine in {"x86_64", "amd64"}:
129+
return LINUX_WHEEL_PLATFORM_TAG
130+
return default_platform_tag
131+
132+
123133
def cached_download(url: str, destination: Path, *, package_name: str) -> Path:
124134
if destination.exists() and destination.stat().st_size > 0:
125135
return destination
@@ -262,6 +272,6 @@ def finalize_options(self) -> None:
262272

263273
def get_tag(self) -> tuple[str, str, str]:
264274
_, _, platform_tag = super().get_tag()
265-
return "py3", "none", platform_tag
275+
return "py3", "none", wheel_platform_tag(platform_tag)
266276

267277
return build_py, bdist_wheel

tests/test_cppllvm_build.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
from setuptools.errors import SetupError
1010

1111
from cppllvm_build import (
12+
LINUX_WHEEL_PLATFORM_TAG,
1213
PackageBuildConfig,
1314
asset_name,
1415
checksum_asset_name,
1516
current_platform,
17+
wheel_platform_tag,
1618
)
1719

1820

@@ -76,6 +78,14 @@ def test_cformat_asset_name_uses_package_version(self, *_args: object) -> None:
7678
"clang-format-20_windows-amd64.sha512sum",
7779
)
7880

81+
@patch("cppllvm_build.machine", return_value="x86_64")
82+
@patch("cppllvm_build.system", return_value="Linux")
83+
def test_linux_wheel_platform_tag_uses_manylinux(self, *_args: object) -> None:
84+
self.assertEqual(
85+
wheel_platform_tag("linux_x86_64"),
86+
LINUX_WHEEL_PLATFORM_TAG,
87+
)
88+
7989
@patch("cppllvm_build.machine", return_value="arm64")
8090
@patch("cppllvm_build.system", return_value="Linux")
8191
def test_unsupported_platform_raises_clear_error(self, *_args: object) -> None:

0 commit comments

Comments
 (0)