@@ -179,13 +179,13 @@ def _update_configure_preset(existing_preset: ConfigurePreset, build_directory:
179179 existing_preset: The preset to update
180180 build_directory: The build directory to use
181181 """
182- # Update existing preset to ensure it inherits from 'default '
182+ # Update existing preset to ensure it inherits from 'cppython '
183183 if existing_preset .inherits is None :
184- existing_preset .inherits = 'default ' # type: ignore[misc]
185- elif isinstance (existing_preset .inherits , str ) and existing_preset .inherits != 'default ' :
186- existing_preset .inherits = ['default ' , existing_preset .inherits ] # type: ignore[misc]
187- elif isinstance (existing_preset .inherits , list ) and 'default ' not in existing_preset .inherits :
188- existing_preset .inherits .insert (0 , 'default ' )
184+ existing_preset .inherits = 'cppython ' # type: ignore[misc]
185+ elif isinstance (existing_preset .inherits , str ) and existing_preset .inherits != 'cppython ' :
186+ existing_preset .inherits = ['cppython ' , existing_preset .inherits ] # type: ignore[misc]
187+ elif isinstance (existing_preset .inherits , list ) and 'cppython ' not in existing_preset .inherits :
188+ existing_preset .inherits .insert (0 , 'cppython ' )
189189
190190 # Update binary directory if not set
191191 if not existing_preset .binaryDir :
@@ -214,10 +214,10 @@ def _modify_presets(
214214 existing_preset = next (
215215 (p for p in root_preset .configurePresets if p .name == user_configure_preset .name ), None
216216 )
217- if existing_preset :
218- Builder ._update_configure_preset (existing_preset , build_directory )
219- else :
220- root_preset .configurePresets .append (user_configure_preset )
217+ if existing_preset :
218+ Builder ._update_configure_preset (existing_preset , build_directory )
219+ else :
220+ root_preset .configurePresets .append (user_configure_preset )
221221
222222 if root_preset .buildPresets is None :
223223 root_preset .buildPresets = user_build_presets .copy () # type: ignore[misc]
@@ -304,8 +304,8 @@ def write_root_presets(
304304 initial_json = file .read ()
305305 initial_root_preset = CMakePresets .model_validate_json (initial_json )
306306
307- # Ensure that the build_directory is relative to the preset_file
308- build_directory = build_directory .relative_to (preset_file .parent )
307+ # Ensure that the build_directory is relative to the preset_file, allowing upward traversal
308+ build_directory = build_directory .relative_to (preset_file .parent , walk_up = True )
309309
310310 root_preset = Builder .generate_root_preset (preset_file , cppython_preset_file , cmake_data , build_directory )
311311
0 commit comments