Skip to content

Commit 7f87b9e

Browse files
trivialfishcho3jakirkham
authored
Ensure that pip check does not fail due to bad platform tag (dmlc#10755) (dmlc#10902)
--------- Co-authored-by: Philip Hyunsu Cho <[email protected]> Co-authored-by: jakirkham <[email protected]>
1 parent cc6d03c commit 7f87b9e

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

python-package/hatch_build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
Here, we customize the tag of the generated wheels.
44
"""
55

6-
import sysconfig
76
from typing import Any, Dict
87

98
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
9+
from packaging.tags import platform_tags
1010

1111

1212
def get_tag() -> str:
1313
"""Get appropriate wheel tag according to system"""
14-
tag_platform = sysconfig.get_platform().replace("-", "_").replace(".", "_")
15-
return f"py3-none-{tag_platform}"
14+
platform_tag = next(platform_tags())
15+
return f"py3-none-{platform_tag}"
1616

1717

1818
class CustomBuildHook(BuildHookInterface):

python-package/pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[build-system]
22
requires = [
3-
"hatchling>=1.12.1"
3+
"hatchling>=1.12.1",
4+
"packaging>=21.3",
45
]
56
backend-path = ["."]
67
build-backend = "packager.pep517"
@@ -30,7 +31,7 @@ classifiers = [
3031
dependencies = [
3132
"numpy",
3233
"scipy",
33-
"nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'"
34+
"nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'",
3435
]
3536

3637
[project.urls]

tests/buildkite/remove_nccl_dep.patch

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
diff --git python-package/pyproject.toml python-package/pyproject.toml
2-
index 8835def25..46c1451c2 100644
2+
index 20d3f9974..953087ff4 100644
33
--- python-package/pyproject.toml
44
+++ python-package/pyproject.toml
5-
@@ -30,8 +30,7 @@ classifiers = [
6-
]
5+
@@ -30,7 +30,6 @@ classifiers = [
76
dependencies = [
87
"numpy",
9-
- "scipy",
10-
- "nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'"
11-
+ "scipy"
8+
"scipy",
9+
- "nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'",
1210
]
1311

1412
[project.urls]

0 commit comments

Comments
 (0)