Skip to content

Commit 2411ee7

Browse files
committed
Profile Default Fallback
1 parent ca5e4eb commit 2411ee7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

cppython/plugins/conan/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def package(self):
161161
'name': name,
162162
'version': version,
163163
'dependencies': [dependency.requires() for dependency in dependencies],
164-
'preset_file': str(preset_file),
164+
'preset_file': preset_file.as_posix(), # Cross-platform path with forward slashes
165165
}
166166

167167
result = template.substitute(values)

cppython/plugins/conan/plugin.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def __init__(
4343
self._cli = Cli(self._conan_api)
4444
self._cli.add_commands()
4545

46+
self._ensure_default_profiles()
47+
4648
@staticmethod
4749
def features(directory: Path) -> SupportedFeatures:
4850
"""Queries conan support
@@ -114,6 +116,15 @@ def _prepare_installation(self) -> Path:
114116

115117
return conanfile_path
116118

119+
def _ensure_default_profiles(self) -> None:
120+
"""Ensure default Conan profiles exist, creating them if necessary."""
121+
try:
122+
self._conan_api.profiles.get_default_host()
123+
self._conan_api.profiles.get_default_build()
124+
except Exception:
125+
# If profiles don't exist, create them using profile detect
126+
self._conan_api.command.run(['profile', 'detect'])
127+
117128
def _run_conan_install(self, conanfile_path: Path, update: bool, logger) -> None:
118129
"""Run conan install command using Conan API.
119130

0 commit comments

Comments
 (0)