1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
"""
Custom hook to customize the behavior of Hatchling.
Here, we customize the tag of the generated wheels.
"""
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"""
platform_tag = next(platform_tags())
return f"py3-none-{platform_tag}"
class CustomBuildHook(BuildHookInterface):
"""A custom build hook"""
def initialize(self, version: str, build_data: Dict[str, Any]) -> None:
"""This step ccurs immediately before each build."""
build_data["tag"] = get_tag()
|