From 2786e6f6f12c1461539d8c2364608b5a8834671f Mon Sep 17 00:00:00 2001 From: Haibao Tang Date: Sat, 4 Jan 2025 19:24:16 -0800 Subject: [PATCH] call get_abi_tag() from wheel._bdist_wheel --- build.py | 12 ++++++------ pyproject.toml | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build.py b/build.py index f604ede1..52ac4388 100644 --- a/build.py +++ b/build.py @@ -1,7 +1,7 @@ import subprocess -import sysconfig from hatchling.builders.hooks.plugin.interface import BuildHookInterface +from wheel._bdist_wheel import get_abi_tag, get_platform, tags class CustomBuildHook(BuildHookInterface): @@ -15,8 +15,8 @@ def initialize(self, version, build_data): def _get_wheel_tag(self): # Without the tag, the wheel will be named jcvi-0.0.0-py3-none-any.whl - platform_tag = sysconfig.get_platform().replace("-", "_").replace(".", "_") - python_version = sysconfig.get_python_version().replace(".", "") # e.g., "310" - python_impl = "cp" # Assuming CPython. Modify if using PyPy or others. - abi_tag = f"{python_impl}{python_version}" - return f"{python_impl}{python_version}-{abi_tag}-{platform_tag}" + impl_name = tags.interpreter_name() + impl_ver = tags.interpreter_version() + abi_tag = get_abi_tag() + plat_tag = get_platform(None) + return f"{impl_name}{impl_ver}-{abi_tag}-{plat_tag}" diff --git a/pyproject.toml b/pyproject.toml index ee852241..5c1ce1e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ requires = [ "hatchling", # Build backend "hatch-vcs", # Version control system plugin for dynamic versioning "setuptools", # Setuptools for compiling C extensions + "wheel", # Wheel for packaging "cython", # Cython for compiling C extensions "numpy", # NumPy for numerical operations and C extension includes ]