2
2
3
3
import logging
4
4
import os
5
+ import platform as sysplatform
6
+ import sys
5
7
import typing as t
6
8
7
9
from hatchling .builders .hooks .plugin .interface import BuildHookInterface
@@ -18,7 +20,7 @@ class HatchCppBuildHook(BuildHookInterface[HatchCppBuildConfig]):
18
20
PLUGIN_NAME = "hatch-cpp"
19
21
_logger = logging .getLogger (__name__ )
20
22
21
- def initialize (self , version : str , _ : dict [str , t .Any ]) -> None :
23
+ def initialize (self , version : str , build_data : dict [str , t .Any ]) -> None :
22
24
"""Initialize the plugin."""
23
25
# Log some basic information
24
26
self ._logger .info ("Initializing hatch-cpp plugin version %s" , version )
@@ -30,6 +32,19 @@ def initialize(self, version: str, _: dict[str, t.Any]) -> None:
30
32
self ._logger .info ("ignoring target name %s" , self .target_name )
31
33
return
32
34
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
+
33
48
# Skip if SKIP_HATCH_CPP is set
34
49
# TODO: Support CLI once https://github.com/pypa/hatch/pull/1743
35
50
if os .getenv ("SKIP_HATCH_CPP" ):
0 commit comments