11"""Construction of Conan data"""
22
3- import shutil
4- from pathlib import Path , PurePosixPath
3+ from pathlib import Path
54
65from pydantic import DirectoryPath
76
@@ -20,15 +19,13 @@ def _create_base_conanfile(
2019 base_file : Path ,
2120 dependencies : list [ConanDependency ],
2221 dependency_groups : dict [str , list [ConanDependency ]],
23- cmake_binary : Path | None = None ,
2422 ) -> None :
2523 """Creates a conanfile_base.py with CPPython managed dependencies.
2624
2725 Args:
2826 base_file: Path to write the base conanfile
2927 dependencies: List of main dependencies
3028 dependency_groups: Dictionary of dependency groups (e.g., 'test')
31- cmake_binary: Optional path to CMake binary to use
3229 """
3330 test_dependencies = dependency_groups .get ('test' , [])
3431
@@ -46,16 +43,6 @@ def _create_base_conanfile(
4643 '\n ' .join (test_requires_lines ) if test_requires_lines else ' pass # No test requirements'
4744 )
4845
49- # Generate configure method content for cmake_program if specified
50- if cmake_binary :
51- # Use PurePosixPath for conan compatibility and space handling
52- cmake_path_str = f'"{ PurePosixPath (cmake_binary .resolve ())} "'
53- configure_content = f''' def configure(self):
54- """CPPython managed configuration."""
55- self.conf.define("tools.cmake:cmake_program", { repr (cmake_path_str )} )'''
56- else :
57- configure_content = ''
58-
5946 content = f'''"""CPPython managed base ConanFile.
6047
6148This file is auto-generated by CPPython. Do not edit manually.
@@ -67,7 +54,6 @@ def _create_base_conanfile(
6754
6855class CPPythonBase(ConanFile):
6956 """Base ConanFile with CPPython managed dependencies."""
70- { configure_content }
7157
7258 def requirements(self):
7359 """CPPython managed requirements."""
@@ -164,25 +150,13 @@ def generate_conanfile(
164150
165151 Args:
166152 directory: The project directory
167- data: Generation data containing dependencies, project info, and cmake binary path.
168- If cmake_binary is not provided, attempts to find cmake in the current
169- Python environment.
153+ data: Generation data containing dependencies and project info.
170154 """
171155 directory .mkdir (parents = True , exist_ok = True )
172156
173- # Resolve cmake binary path
174- resolved_cmake : Path | None = None
175- if data .cmake_binary and data .cmake_binary != 'cmake' :
176- resolved_cmake = Path (data .cmake_binary ).resolve ()
177- else :
178- # Try to find cmake in the current Python environment (venv)
179- cmake_path = shutil .which ('cmake' )
180- if cmake_path :
181- resolved_cmake = Path (cmake_path ).resolve ()
182-
183157 # Always regenerate the base conanfile with managed dependencies
184158 base_file = directory / 'conanfile_base.py'
185- self ._create_base_conanfile (base_file , data .dependencies , data .dependency_groups , resolved_cmake )
159+ self ._create_base_conanfile (base_file , data .dependencies , data .dependency_groups )
186160
187161 # Only create conanfile.py if it doesn't exist
188162 conan_file = directory / self ._filename
0 commit comments