Skip to content

Commit d03edb6

Browse files
committed
Remove Preset Injection
1 parent bd73f82 commit d03edb6

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

cppython/plugins/conan/builder.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ def __init__(self) -> None:
121121
self._filename = 'conanfile.py'
122122

123123
@staticmethod
124-
def _create_conanfile(
125-
conan_file: Path, dependencies: list[ConanDependency], name: str, version: str, preset_file: Path
126-
) -> None:
124+
def _create_conanfile(conan_file: Path, dependencies: list[ConanDependency], name: str, version: str) -> None:
127125
"""Creates a conanfile.py file with the necessary content."""
128126
template_string = """
129127
from conan import ConanFile
@@ -142,7 +140,7 @@ def generate(self):
142140
deps = CMakeDeps(self)
143141
deps.generate()
144142
tc = CMakeToolchain(self)
145-
tc.user_presets_path = "${preset_file}"
143+
tc.user_presets_path = None
146144
tc.generate()
147145
148146
def build(self):
@@ -161,7 +159,6 @@ def package(self):
161159
'name': name,
162160
'version': version,
163161
'dependencies': [dependency.requires() for dependency in dependencies],
164-
'preset_file': preset_file.as_posix(), # Cross-platform path with forward slashes
165162
}
166163

167164
result = template.substitute(values)
@@ -170,7 +167,7 @@ def package(self):
170167
file.write(result)
171168

172169
def generate_conanfile(
173-
self, directory: DirectoryPath, dependencies: list[ConanDependency], name: str, version: str, preset_file: Path
170+
self, directory: DirectoryPath, dependencies: list[ConanDependency], name: str, version: str
174171
) -> None:
175172
"""Generate a conanfile.py file for the project."""
176173
conan_file = directory / self._filename
@@ -185,4 +182,4 @@ def generate_conanfile(
185182
conan_file.write_text(modified.code, encoding='utf-8')
186183
else:
187184
directory.mkdir(parents=True, exist_ok=True)
188-
self._create_conanfile(conan_file, dependencies, name, version, preset_file)
185+
self._create_conanfile(conan_file, dependencies, name, version)

cppython/plugins/conan/plugin.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def _prepare_installation(self) -> Path:
103103
resolved_dependencies,
104104
self.core_data.pep621_data.name,
105105
self.core_data.pep621_data.version,
106-
self.core_data.cppython_data.tool_path / 'ConanPresets.json',
107106
)
108107

109108
# Ensure build directory exists
@@ -217,11 +216,11 @@ def _create_cmake_sync_data(self) -> CMakeSyncData:
217216
"""
218217
# Conan's CMakeToolchain generator creates preset files at the configured user_presets_path
219218
# This should match the path configured in the conanfile template
220-
conan_preset_path = self.core_data.cppython_data.tool_path / 'ConanPresets.json'
219+
conan_toolchain_path = self.core_data.cppython_data.tool_path / 'ConanPresets.json'
221220

222221
return CMakeSyncData(
223222
provider_name=TypeName('conan'),
224-
preset_file=conan_preset_path,
223+
toolchain=conan_toolchain_path,
225224
)
226225

227226
@classmethod

0 commit comments

Comments
 (0)