Skip to content

Commit ddee3e8

Browse files
authored
Merge pull request #16 from python-project-templates/tkp/wheel
Form wheel name
2 parents 9701684 + 090cdd0 commit ddee3e8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

hatch_cpp/plugin.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import logging
44
import os
5+
import platform as sysplatform
6+
import sys
57
import typing as t
68

79
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
@@ -18,7 +20,7 @@ class HatchCppBuildHook(BuildHookInterface[HatchCppBuildConfig]):
1820
PLUGIN_NAME = "hatch-cpp"
1921
_logger = logging.getLogger(__name__)
2022

21-
def initialize(self, version: str, _: dict[str, t.Any]) -> None:
23+
def initialize(self, version: str, build_data: dict[str, t.Any]) -> None:
2224
"""Initialize the plugin."""
2325
# Log some basic information
2426
self._logger.info("Initializing hatch-cpp plugin version %s", version)
@@ -30,6 +32,19 @@ def initialize(self, version: str, _: dict[str, t.Any]) -> None:
3032
self._logger.info("ignoring target name %s", self.target_name)
3133
return
3234

35+
build_data["pure_python"] = False
36+
machine = sysplatform.machine()
37+
version_major = sys.version_info.major
38+
version_minor = sys.version_info.minor
39+
# TODO abi3
40+
if "darwin" in sys.platform:
41+
os_name = "macosx_11_0"
42+
elif "linux" in sys.platform:
43+
os_name = "linux"
44+
else:
45+
os_name = "win"
46+
build_data["tag"] = f"cp{version_major}{version_minor}-cp{version_major}{version_minor}-{os_name}_{machine}"
47+
3348
# Skip if SKIP_HATCH_CPP is set
3449
# TODO: Support CLI once https://github.com/pypa/hatch/pull/1743
3550
if os.getenv("SKIP_HATCH_CPP"):

0 commit comments

Comments
 (0)