hatch-cpp 0.6.0__tar.gz → 0.6.1__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.
Files changed (84) hide show
  1. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/PKG-INFO +1 -1
  2. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/__init__.py +1 -1
  3. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/config.py +2 -2
  4. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_projects.py +6 -1
  5. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_vcpkg_ref.py +10 -0
  6. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/toolchains/cmake.py +3 -16
  7. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/toolchains/vcpkg.py +2 -2
  8. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/pyproject.toml +2 -2
  9. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/.gitignore +0 -0
  10. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/LICENSE +0 -0
  11. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/README.md +0 -0
  12. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/hooks.py +0 -0
  13. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/plugin.py +0 -0
  14. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_hatch_build.py +0 -0
  15. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_hook_registration.py +0 -0
  16. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_platform_specific.py +0 -0
  17. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_basic/cpp/project/basic.cpp +0 -0
  18. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_basic/cpp/project/basic.hpp +0 -0
  19. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_basic/project/__init__.py +0 -0
  20. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_basic/pyproject.toml +0 -0
  21. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_c_abi_library/cpp/demo.c +0 -0
  22. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_c_abi_library/cpp/extension.c +0 -0
  23. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_c_abi_library/cpp/include/demo/demo.h +0 -0
  24. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_c_abi_library/project/__init__.py +0 -0
  25. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_c_abi_library/pyproject.toml +0 -0
  26. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake/CMakeLists.txt +0 -0
  27. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake/Makefile +0 -0
  28. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake/cpp/project/basic.cpp +0 -0
  29. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake/cpp/project/basic.hpp +0 -0
  30. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake/project/__init__.py +0 -0
  31. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake/project/include/project/basic.hpp +0 -0
  32. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake/pyproject.toml +0 -0
  33. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_c_abi/CMakeLists.txt +0 -0
  34. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_c_abi/cpp/demo.c +0 -0
  35. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_c_abi/cpp/extension.c +0 -0
  36. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_c_abi/cpp/include/demo/demo.h +0 -0
  37. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_c_abi/project/__init__.py +0 -0
  38. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_c_abi/pyproject.toml +0 -0
  39. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_vcpkg/CMakeLists.txt +0 -0
  40. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_vcpkg/Makefile +0 -0
  41. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.cpp +0 -0
  42. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.hpp +0 -0
  43. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_vcpkg/project/__init__.py +0 -0
  44. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_vcpkg/project/include/project/basic.hpp +0 -0
  45. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_vcpkg/pyproject.toml +0 -0
  46. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_cmake_vcpkg/vcpkg.json +0 -0
  47. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_hatch_build/cpp/project/basic.cpp +0 -0
  48. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_hatch_build/cpp/project/basic.hpp +0 -0
  49. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_hatch_build/project/__init__.py +0 -0
  50. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_hatch_build/pyproject.toml +0 -0
  51. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_limited_api/cpp/project/basic.cpp +0 -0
  52. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_limited_api/cpp/project/basic.hpp +0 -0
  53. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_limited_api/project/__init__.py +0 -0
  54. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_limited_api/pyproject.toml +0 -0
  55. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_nanobind/cpp/project/basic.cpp +0 -0
  56. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_nanobind/cpp/project/basic.hpp +0 -0
  57. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_nanobind/project/__init__.py +0 -0
  58. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_nanobind/pyproject.toml +0 -0
  59. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_override_classes/cpp/project/basic.cpp +0 -0
  60. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_override_classes/cpp/project/basic.hpp +0 -0
  61. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_override_classes/project/__init__.py +0 -0
  62. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_override_classes/pyproject.toml +0 -0
  63. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.cpp +0 -0
  64. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.hpp +0 -0
  65. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_override_toolchain/project/__init__.py +0 -0
  66. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_override_toolchain/pyproject.toml +0 -0
  67. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pybind/cpp/project/basic.cpp +0 -0
  68. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pybind/cpp/project/basic.hpp +0 -0
  69. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pybind/project/__init__.py +0 -0
  70. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pybind/pyproject.toml +0 -0
  71. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.cpp +0 -0
  72. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.hpp +0 -0
  73. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pybind_vcpkg/project/__init__.py +0 -0
  74. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pybind_vcpkg/pyproject.toml +0 -0
  75. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pybind_vcpkg/vcpkg.json +0 -0
  76. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pyodide/cpp/extension.cpp +0 -0
  77. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pyodide/pyodide_project/__init__.py +0 -0
  78. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pyodide/pyodide_project/extension.pyi +0 -0
  79. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_project_pyodide/pyproject.toml +0 -0
  80. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_structs.py +0 -0
  81. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/tests/test_validation.py +0 -0
  82. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/toolchains/__init__.py +0 -0
  83. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/toolchains/common.py +0 -0
  84. {hatch_cpp-0.6.0 → hatch_cpp-0.6.1}/hatch_cpp/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: hatch-cpp
3
- Version: 0.6.0
3
+ Version: 0.6.1
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
@@ -1,4 +1,4 @@
1
- __version__ = "0.6.0"
1
+ __version__ = "0.6.1"
2
2
 
3
3
  from .config import *
4
4
  from .hooks import *
@@ -197,8 +197,8 @@ class HatchCppBuildPlan(HatchCppBuildConfig):
197
197
  if self.platform.platform == "emscripten":
198
198
  objects = []
199
199
  for source_index, source in enumerate(library.sources):
200
- obj = Path("build/hatch-cpp") / f"{library_index}-{source_index}-{Path(source).stem}.o"
201
- objects.append(str(obj))
200
+ obj = f"build/hatch-cpp/{library_index}-{source_index}-{Path(source).stem}.o"
201
+ objects.append(obj)
202
202
  self.commands.append(f"{compiler} -c {source} {compile_flags} -o {obj}")
203
203
  self.commands.append(f"{compiler} {' '.join(objects)} {link_flags}")
204
204
  else:
@@ -15,7 +15,12 @@ class TestProject:
15
15
  [
16
16
  "test_project_basic",
17
17
  "test_project_override_classes",
18
- "test_project_override_toolchain",
18
+ pytest.param(
19
+ "test_project_override_toolchain",
20
+ marks=pytest.mark.skipif(
21
+ platform == "win32", reason="the fixture selects the gcc toolchain, whose flags clang rejects for MSVC targets"
22
+ ),
23
+ ),
19
24
  "test_project_pybind",
20
25
  "test_project_pybind_vcpkg",
21
26
  "test_project_nanobind",
@@ -125,6 +125,11 @@ class TestVcpkgGenerate:
125
125
  """Create a minimal vcpkg.json so generate() produces commands."""
126
126
  (tmp_path / "vcpkg.json").write_text("{}")
127
127
 
128
+ def _pin_linux_host(self, monkeypatch):
129
+ """Make generate() behave as on an x86_64 Linux host, whatever host runs the test."""
130
+ monkeypatch.setattr("hatch_cpp.toolchains.vcpkg.sys_platform", "linux")
131
+ monkeypatch.setattr("hatch_cpp.toolchains.vcpkg.platform_machine", lambda: "x86_64")
132
+
128
133
  def test_generate_with_explicit_ref(self, tmp_path, monkeypatch):
129
134
  monkeypatch.chdir(tmp_path)
130
135
  self._make_vcpkg_env(tmp_path)
@@ -164,6 +169,7 @@ class TestVcpkgGenerate:
164
169
 
165
170
  def test_generate_uses_posix_command_paths(self, tmp_path, monkeypatch):
166
171
  monkeypatch.chdir(tmp_path)
172
+ self._pin_linux_host(monkeypatch)
167
173
  self._make_vcpkg_env(tmp_path)
168
174
 
169
175
  cfg = HatchCppVcpkgConfiguration(vcpkg_triplet="x64-linux")
@@ -185,6 +191,7 @@ class TestVcpkgGenerate:
185
191
 
186
192
  def test_generate_detects_emscripten_triplet(self, tmp_path, monkeypatch):
187
193
  monkeypatch.chdir(tmp_path)
194
+ self._pin_linux_host(monkeypatch)
188
195
  self._make_vcpkg_env(tmp_path)
189
196
  build_plan = SimpleNamespace(platform=SimpleNamespace(platform="emscripten"))
190
197
 
@@ -206,6 +213,7 @@ class TestVcpkgGenerate:
206
213
 
207
214
  def test_generate_skips_clone_when_vcpkg_root_exists(self, tmp_path, monkeypatch):
208
215
  monkeypatch.chdir(tmp_path)
216
+ self._pin_linux_host(monkeypatch)
209
217
  self._make_vcpkg_env(tmp_path)
210
218
  vcpkg_root = tmp_path / "vcpkg"
211
219
  vcpkg_root.mkdir()
@@ -225,6 +233,7 @@ class TestVcpkgGenerate:
225
233
 
226
234
  def test_generate_reclones_when_vcpkg_root_exists_but_empty(self, tmp_path, monkeypatch):
227
235
  monkeypatch.chdir(tmp_path)
236
+ self._pin_linux_host(monkeypatch)
228
237
  self._make_vcpkg_env(tmp_path)
229
238
  (tmp_path / "vcpkg").mkdir()
230
239
 
@@ -253,6 +262,7 @@ class TestVcpkgGenerate:
253
262
 
254
263
  def test_generate_reclones_when_vcpkg_exists_but_not_working(self, tmp_path, monkeypatch):
255
264
  monkeypatch.chdir(tmp_path)
265
+ self._pin_linux_host(monkeypatch)
256
266
  self._make_vcpkg_env(tmp_path)
257
267
  vcpkg_root = tmp_path / "vcpkg"
258
268
  vcpkg_root.mkdir()
@@ -10,16 +10,6 @@ from .common import Platform
10
10
 
11
11
  __all__ = ("HatchCppCmakeConfiguration",)
12
12
 
13
- DefaultMSVCGenerator = {
14
- "12": "Visual Studio 12 2013",
15
- "14": "Visual Studio 14 2015",
16
- "14.0": "Visual Studio 14 2015",
17
- "14.1": "Visual Studio 15 2017",
18
- "14.2": "Visual Studio 16 2019",
19
- "14.3": "Visual Studio 17 2022",
20
- "14.4": "Visual Studio 17 2022",
21
- }
22
-
23
13
 
24
14
  class HatchCppCmakeConfiguration(BaseModel):
25
15
  root: Path | None = None
@@ -54,13 +44,10 @@ class HatchCppCmakeConfiguration(BaseModel):
54
44
  commands[-1] += f" -DCMAKE_INSTALL_PREFIX={Path(self.root).parent}"
55
45
 
56
46
  # TODO: CMAKE_CXX_COMPILER
57
- # Respect CMAKE_GENERATOR environment variable
47
+ # Respect CMAKE_GENERATOR environment variable. Without it CMake picks its default,
48
+ # which on Windows is the newest installed Visual Studio.
58
49
  cmake_generator = environ.get("CMAKE_GENERATOR", "")
59
- if config.platform.platform == "win32":
60
- if not cmake_generator:
61
- cmake_generator = "Visual Studio 17 2022"
62
- commands[-1] += f' -G "{cmake_generator}"'
63
- elif cmake_generator:
50
+ if cmake_generator:
64
51
  commands[-1] += f' -G "{cmake_generator}"'
65
52
 
66
53
  # Put in CMake flags
@@ -57,7 +57,7 @@ def _read_vcpkg_ref_from_gitmodules(vcpkg_root: Path) -> str | None:
57
57
  parser.read(str(gitmodules_path))
58
58
 
59
59
  for section in parser.sections():
60
- if parser.get(section, "path", fallback=None) == str(vcpkg_root):
60
+ if parser.get(section, "path", fallback=None) == vcpkg_root.as_posix():
61
61
  return parser.get(section, "branch", fallback=None)
62
62
 
63
63
  return None
@@ -93,7 +93,7 @@ class HatchCppVcpkgConfiguration(BaseModel):
93
93
  def _command_path(self, path: Path) -> str:
94
94
  if sys_platform == "win32":
95
95
  return str(path).replace("/", "\\")
96
- return f"./{path}"
96
+ return f"./{path.as_posix()}"
97
97
 
98
98
  def _delete_dir_command(self, path: Path) -> str:
99
99
  if sys_platform == "win32":
@@ -12,7 +12,7 @@ authors = [
12
12
  description = "Hatch plugin for C++ builds"
13
13
  readme = "README.md"
14
14
  license = { text = "Apache-2.0" }
15
- version = "0.6.0"
15
+ version = "0.6.1"
16
16
  requires-python = ">=3.10"
17
17
  keywords = [
18
18
  "hatch",
@@ -81,7 +81,7 @@ Repository = "https://github.com/python-project-templates/hatch-cpp"
81
81
  Homepage = "https://github.com/python-project-templates/hatch-cpp"
82
82
 
83
83
  [tool.bumpversion]
84
- current_version = "0.6.0"
84
+ current_version = "0.6.1"
85
85
  commit = true
86
86
  tag = true
87
87
  commit_args = "-s"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes