Ensure that pip check does not fail due to bad platform tag (#10755)
* Remove custom tag generation * Revert "Remove custom tag generation" This reverts commit fe3cf0e8786c7dc05e1deced3a1c92cd79094735. * 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 <jakirkham@gmail.com> --------- Co-authored-by: jakirkham <jakirkham@gmail.com>
This commit is contained in:
parent
64afe9873b
commit
7794d3da8a
@ -3,16 +3,16 @@ Custom hook to customize the behavior of Hatchling.
|
||||
Here, we customize the tag of the generated wheels.
|
||||
"""
|
||||
|
||||
import sysconfig
|
||||
from typing import Any, Dict
|
||||
|
||||
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
||||
from packaging.tags import platform_tags
|
||||
|
||||
|
||||
def get_tag() -> str:
|
||||
"""Get appropriate wheel tag according to system"""
|
||||
tag_platform = sysconfig.get_platform().replace("-", "_").replace(".", "_")
|
||||
return f"py3-none-{tag_platform}"
|
||||
platform_tag = next(platform_tags())
|
||||
return f"py3-none-{platform_tag}"
|
||||
|
||||
|
||||
class CustomBuildHook(BuildHookInterface):
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
[build-system]
|
||||
requires = [
|
||||
"hatchling>=1.12.1"
|
||||
"hatchling>=1.12.1",
|
||||
"packaging>=21.3",
|
||||
]
|
||||
backend-path = ["."]
|
||||
build-backend = "packager.pep517"
|
||||
@ -29,7 +30,7 @@ classifiers = [
|
||||
dependencies = [
|
||||
"numpy",
|
||||
"scipy",
|
||||
"nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'"
|
||||
"nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
diff --git python-package/pyproject.toml python-package/pyproject.toml
|
||||
index 8835def25..46c1451c2 100644
|
||||
index 20d3f9974..953087ff4 100644
|
||||
--- python-package/pyproject.toml
|
||||
+++ python-package/pyproject.toml
|
||||
@@ -30,8 +30,7 @@ classifiers = [
|
||||
]
|
||||
@@ -30,7 +30,6 @@ classifiers = [
|
||||
dependencies = [
|
||||
"numpy",
|
||||
- "scipy",
|
||||
- "nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'"
|
||||
+ "scipy"
|
||||
"scipy",
|
||||
- "nvidia-nccl-cu12 ; platform_system == 'Linux' and platform_machine != 'aarch64'",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user