Conversation
On Windows, passing native paths with backslashes (such as %PYTHON%) to CMake causes invalid character escape errors (e.g. 'Invalid character escape \'\w\'') when CMake generates install scripts (like cmake_install.cmake in ROS 2 rosidl Python bindings). Normalize %PYTHON%, %LIBRARY_PREFIX%, and %SRC_DIR% with forward slashes and quote CMake arguments in bld_ament_cmake.bat and bld_catkin.bat. Closes prefix-dev#6955. Signed-off-by: aoright <102943475+aoright@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When building ROS packages on Windows (such as
ament_cmakepackages generatingrosidlPython message bindings), CMake generates install scripts (e.g.cmake_install.cmake). Because native Windows paths contain backslashes (\), CMake string parsing encounters syntax errors such asInvalid character escape '\w'when executingcompileallonPYTHON_EXECUTABLEorLIBRARY_PREFIX.This PR:
%PYTHON%,%LIBRARY_PREFIX%, and%SRC_DIR%with forward slashes before passing them to CMake inbld_ament_cmake.batandbld_catkin.bat.render_build_script_with_platformrenders forward-slash conversions and quoted variables for Windowsament_cmakeandcatkinbuilds.Fixes #6955
How Has This Been Tested?
test_render_ament_cmake_windowsandtest_render_catkin_windowsincrates/pixi_build_ros/src/build_script.rsverifying proper normalization and argument quotation on Windows.cargo test -p pixi-build-ros(all 89 tests passed).AI Disclosure
Tools: Claude
Checklist: