Skip to content

Commit 7794d3d

Browse files
hcho3jakirkham
andauthored
Ensure that pip check does not fail due to bad platform tag (dmlc#10755)
* Remove custom tag generation * Revert "Remove custom tag generation" This reverts commit fe3cf0e. * Fetch an accurate platform tag from Pip 22+ * Fix formatting * TOML allows trailing commas * Update patch * Add trailing comma * Fix up patch * Use `packaging` Co-authored-by: jakirkham <[email protected]> --------- Co-authored-by: jakirkham <[email protected]>
1 parent 64afe98 commit 7794d3d

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"
@@ -29,7 +30,7 @@ classifiers = [
2930
dependencies = [
3031
"numpy",
3132
"scipy",
32-
"nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'"
33+
"nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'",
3334
]
3435

3536
[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)