hatch-cpp 0.3.1__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/PKG-INFO +1 -1
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/__init__.py +1 -1
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_platform_specific.py +79 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/toolchains/common.py +11 -3
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/pyproject.toml +2 -2
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/.gitignore +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/LICENSE +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/README.md +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/config.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/hooks.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/plugin.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_hatch_build.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_basic/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_basic/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_basic/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_basic/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake/CMakeLists.txt +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake/Makefile +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake/project/include/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/CMakeLists.txt +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/Makefile +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/project/include/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/vcpkg.json +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_hatch_build/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_hatch_build/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_hatch_build/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_hatch_build/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_limited_api/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_limited_api/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_limited_api/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_limited_api/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_nanobind/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_nanobind/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_nanobind/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_nanobind/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_classes/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_classes/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_classes/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_classes/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_toolchain/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_toolchain/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.cpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.hpp +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind_vcpkg/project/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind_vcpkg/pyproject.toml +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind_vcpkg/vcpkg.json +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_projects.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_structs.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/toolchains/__init__.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/toolchains/cmake.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/toolchains/vcpkg.py +0 -0
- {hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hatch-cpp
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Hatch plugin for C++ builds
|
|
5
5
|
Project-URL: Repository, https://github.com/python-project-templates/hatch-cpp
|
|
6
6
|
Project-URL: Homepage, https://github.com/python-project-templates/hatch-cpp
|
|
@@ -454,3 +454,82 @@ class TestPlatformFieldOrdering:
|
|
|
454
454
|
# Base list should not be modified
|
|
455
455
|
assert library.include_dirs == ["common"]
|
|
456
456
|
assert library.include_dirs_linux == ["linux"]
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
class TestMSVCPythonLibsPath:
|
|
460
|
+
"""Tests for MSVC Python libs path discovery."""
|
|
461
|
+
|
|
462
|
+
def test_msvc_link_flags_include_libpath(self):
|
|
463
|
+
"""Test that MSVC link flags include /LIBPATH for Python libs."""
|
|
464
|
+
library = HatchCppLibrary(
|
|
465
|
+
name="test",
|
|
466
|
+
sources=["test.cpp"],
|
|
467
|
+
binding="generic", # Skip Python.h include
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
platform = HatchCppPlatform(
|
|
471
|
+
cc="cl",
|
|
472
|
+
cxx="cl",
|
|
473
|
+
ld="link",
|
|
474
|
+
platform="win32",
|
|
475
|
+
toolchain="msvc",
|
|
476
|
+
disable_ccache=True,
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
flags = platform.get_link_flags(library)
|
|
480
|
+
# Should have /link /DLL flags
|
|
481
|
+
assert "/link" in flags
|
|
482
|
+
assert "/DLL" in flags
|
|
483
|
+
# Should have output file
|
|
484
|
+
assert "/Fe:" in flags
|
|
485
|
+
|
|
486
|
+
def test_msvc_link_flags_with_libraries(self):
|
|
487
|
+
"""Test that MSVC link flags properly format library names."""
|
|
488
|
+
library = HatchCppLibrary(
|
|
489
|
+
name="test",
|
|
490
|
+
sources=["test.cpp"],
|
|
491
|
+
binding="generic",
|
|
492
|
+
libraries=["mylib"],
|
|
493
|
+
library_dirs=["path/to/libs"],
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
platform = HatchCppPlatform(
|
|
497
|
+
cc="cl",
|
|
498
|
+
cxx="cl",
|
|
499
|
+
ld="link",
|
|
500
|
+
platform="win32",
|
|
501
|
+
toolchain="msvc",
|
|
502
|
+
disable_ccache=True,
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
flags = platform.get_link_flags(library)
|
|
506
|
+
# Libraries should have .lib suffix on Windows
|
|
507
|
+
assert "mylib.lib" in flags
|
|
508
|
+
# Library dirs should use /LIBPATH:
|
|
509
|
+
assert "/LIBPATH:path/to/libs" in flags
|
|
510
|
+
|
|
511
|
+
def test_msvc_link_flags_with_platform_specific_libraries(self):
|
|
512
|
+
"""Test that MSVC uses win32-specific libraries."""
|
|
513
|
+
library = HatchCppLibrary(
|
|
514
|
+
name="test",
|
|
515
|
+
sources=["test.cpp"],
|
|
516
|
+
binding="generic",
|
|
517
|
+
libraries=["common"],
|
|
518
|
+
libraries_win32=["kernel32", "user32"],
|
|
519
|
+
library_dirs_win32=["C:/Windows/System32"],
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
platform = HatchCppPlatform(
|
|
523
|
+
cc="cl",
|
|
524
|
+
cxx="cl",
|
|
525
|
+
ld="link",
|
|
526
|
+
platform="win32",
|
|
527
|
+
toolchain="msvc",
|
|
528
|
+
disable_ccache=True,
|
|
529
|
+
)
|
|
530
|
+
|
|
531
|
+
flags = platform.get_link_flags(library)
|
|
532
|
+
assert "common.lib" in flags
|
|
533
|
+
assert "kernel32.lib" in flags
|
|
534
|
+
assert "user32.lib" in flags
|
|
535
|
+
assert "/LIBPATH:C:/Windows/System32" in flags
|
|
@@ -5,7 +5,7 @@ from pathlib import Path
|
|
|
5
5
|
from re import match
|
|
6
6
|
from shutil import which
|
|
7
7
|
from sys import executable, platform as sys_platform
|
|
8
|
-
from sysconfig import get_path
|
|
8
|
+
from sysconfig import get_config_var, get_path
|
|
9
9
|
from typing import Any, List, Literal, Optional
|
|
10
10
|
|
|
11
11
|
from pydantic import AliasChoices, BaseModel, Field, field_validator, model_validator
|
|
@@ -368,8 +368,16 @@ class HatchCppPlatform(BaseModel):
|
|
|
368
368
|
flags += " /LD"
|
|
369
369
|
flags += f" /Fe:{library.get_qualified_name(self.platform)}"
|
|
370
370
|
flags += " /link /DLL"
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
# Add Python libs directory - check multiple possible locations
|
|
372
|
+
python_libs_paths = [
|
|
373
|
+
Path(executable).parent / "libs", # Standard Python install
|
|
374
|
+
Path(executable).parent.parent / "libs", # Some virtualenv layouts
|
|
375
|
+
Path(get_config_var("installed_base") or "") / "libs", # sysconfig approach
|
|
376
|
+
]
|
|
377
|
+
for libs_path in python_libs_paths:
|
|
378
|
+
if libs_path.exists():
|
|
379
|
+
flags += f" /LIBPATH:{str(libs_path)}"
|
|
380
|
+
break
|
|
373
381
|
flags += " " + " ".join(f"{lib}.lib" for lib in effective_libraries)
|
|
374
382
|
flags += " " + " ".join(f"/LIBPATH:{lib}" for lib in effective_library_dirs)
|
|
375
383
|
# clean
|
|
@@ -8,7 +8,7 @@ authors = [{name = "the hatch-cpp authors", email = "t.paine154@gmail.com"}]
|
|
|
8
8
|
description = "Hatch plugin for C++ builds"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "Apache-2.0" }
|
|
11
|
-
version = "0.3.
|
|
11
|
+
version = "0.3.2"
|
|
12
12
|
requires-python = ">=3.10"
|
|
13
13
|
keywords = [
|
|
14
14
|
"hatch",
|
|
@@ -75,7 +75,7 @@ Repository = "https://github.com/python-project-templates/hatch-cpp"
|
|
|
75
75
|
Homepage = "https://github.com/python-project-templates/hatch-cpp"
|
|
76
76
|
|
|
77
77
|
[tool.bumpversion]
|
|
78
|
-
current_version = "0.3.
|
|
78
|
+
current_version = "0.3.2"
|
|
79
79
|
commit = true
|
|
80
80
|
tag = true
|
|
81
81
|
commit_args = "-s"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_basic/cpp/project/basic.cpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_basic/cpp/project/basic.hpp
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake/cpp/project/basic.cpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake/cpp/project/basic.hpp
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.cpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.hpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_cmake_vcpkg/project/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_hatch_build/cpp/project/basic.cpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_hatch_build/cpp/project/basic.hpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_hatch_build/project/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_limited_api/cpp/project/basic.cpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_limited_api/cpp/project/basic.hpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_limited_api/project/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_nanobind/cpp/project/basic.cpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_nanobind/cpp/project/basic.hpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_nanobind/project/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_classes/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_override_toolchain/pyproject.toml
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind/cpp/project/basic.cpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind/cpp/project/basic.hpp
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.cpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.hpp
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind_vcpkg/project/__init__.py
RENAMED
|
File without changes
|
{hatch_cpp-0.3.1 → hatch_cpp-0.3.2}/hatch_cpp/tests/test_project_pybind_vcpkg/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|