Skip to content

Commit

Permalink
Merge pull request #16 from python-project-templates/tkp/wheel
Browse files Browse the repository at this point in the history
Form wheel name
  • Loading branch information
timkpaine authored Jan 13, 2025
2 parents 9701684 + 090cdd0 commit ddee3e8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion hatch_cpp/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import logging
import os
import platform as sysplatform
import sys
import typing as t

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

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

build_data["pure_python"] = False
machine = sysplatform.machine()
version_major = sys.version_info.major
version_minor = sys.version_info.minor
# TODO abi3
if "darwin" in sys.platform:
os_name = "macosx_11_0"
elif "linux" in sys.platform:
os_name = "linux"
else:
os_name = "win"
build_data["tag"] = f"cp{version_major}{version_minor}-cp{version_major}{version_minor}-{os_name}_{machine}"

# Skip if SKIP_HATCH_CPP is set
# TODO: Support CLI once https://github.com/pypa/hatch/pull/1743
if os.getenv("SKIP_HATCH_CPP"):
Expand Down

0 comments on commit ddee3e8

Please sign in to comment.