Skip to content

Commit

Permalink
call get_abi_tag() from wheel._bdist_wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghaibao committed Jan 5, 2025
1 parent 5ffc2bd commit 2786e6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions build.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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}"
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand Down

0 comments on commit 2786e6f

Please sign in to comment.