diff --git a/Makefile b/Makefile index 1473fb6..f1ad97c 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ dist-build: # build python dists dist-check: ## run python dist checker with twine python -m twine check dist/* -dist: clean build dist-build dist-check ## build all dists +dist: clean dist-build dist-check ## build all dists publish: dist # publish python assets diff --git a/hatch_cpp/__init__.py b/hatch_cpp/__init__.py index 7b0b672..02e0ebb 100644 --- a/hatch_cpp/__init__.py +++ b/hatch_cpp/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.1.4" +__version__ = "0.1.5" from .hooks import hatch_register_build_hook from .plugin import HatchCppBuildHook diff --git a/hatch_cpp/plugin.py b/hatch_cpp/plugin.py index 4166551..2e29539 100644 --- a/hatch_cpp/plugin.py +++ b/hatch_cpp/plugin.py @@ -83,8 +83,5 @@ def initialize(self, version: str, build_data: dict[str, t.Any]) -> None: # force include libraries for library in libraries: - if build_plan.platform.platform == "win32": - suffix = "dll" - else: - suffix = "so" - build_data["force_include"][f"{library.name}.{suffix}"] = f"{library.name}.{suffix}" + name = library.get_qualified_name(build_plan.platform.platform) + build_data["force_include"][name] = name diff --git a/hatch_cpp/structs.py b/hatch_cpp/structs.py index 26f846d..1492720 100644 --- a/hatch_cpp/structs.py +++ b/hatch_cpp/structs.py @@ -52,6 +52,15 @@ class HatchCppLibrary(BaseModel): export_symbols: List[str] = Field(default_factory=list, alias="export-symbols") depends: List[str] = Field(default_factory=list) + def get_qualified_name(self, platform): + if platform == "win32": + suffix = "dll" if self.binding == "none" else "pyd" + elif platform == "darwin" and self.binding == "none": + suffix = "dylib" + else: + suffix = "so" + return f"{self.name}.{suffix}" + class HatchCppPlatform(BaseModel): cc: str diff --git a/pyproject.toml b/pyproject.toml index 4e90653..9b3ca91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ authors = [{name = "the hatch-cpp authors", email = "t.paine154@gmail.com"}] description = "Hatch plugin for C++ builds" readme = "README.md" license = { text = "Apache-2.0" } -version = "0.1.4" +version = "0.1.5" requires-python = ">=3.9" keywords = [ "hatch", @@ -62,7 +62,7 @@ Repository = "https://github.com/python-project-templates/hatch-cpp" Homepage = "https://github.com/python-project-templates/hatch-cpp" [tool.bumpversion] -current_version = "0.1.4" +current_version = "0.1.5" commit = true tag = false