Repository navigation
Activate ROS on Windows when conda runs in Git Bash / MSYS2 / Cygwin - #183
Merged
Tobias-Fischer merged 3 commits intoOct 26, 2026
Merged
Conversation
conda's posix activator runs only etc/conda/activate.d/*.sh, also on Windows, but ros_workspace installed only the .bat/.ps1 scripts there (bld_catkin.bat.in), so a conda env activated from Git Bash got no ROS environment (RoboStack#182). Install activate.sh/deactivate.sh on Windows too and give them a Windows branch that does what activate.bat -> local_setup.bat does: run ament's _local_setup_util.py in "sh" mode to evaluate every package's .dsv hooks, keep values in Windows form for native programs, convert PATH entries with cygpath, and strip ';' (not ':') separators. The Unix branch is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
@traversaro - could you please take a look at this? I couldn't check locally. |
Member
|
@Tobias-Fischer done, I Added some tests and checked it works on Windows. |
Contributor
Author
|
Amazing thank you @traversaro |
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.
Fixes #182: with conda (not pixi) in Git Bash on Windows, a RoboStack environment's ROS activation doesn't run.
conda's posix activator runs only
etc/conda/activate.d/*.sh, also on Windows (PosixActivator,script_extension=".sh"), butbld_catkin.bat.ininstalls only the.bat/.ps1scripts forros_workspace. The published win-64ros2-ros-workspacehas no.shactivation scripts.This change:
bld_catkin.bat.in: also installsactivate.sh/deactivate.shon Windows.activate.sh.in: a Windows branch ($OSTYPEmsys*/cygwin*) that does whatactivate.bat→local_setup.batdoes. It runs ament'sLibrary/_local_setup_util.pyinshmode with the env'spython.exe, so every package's.dsvhooks apply. Values stay in Windows form for native programs; onlyPATHentries are converted withcygpath, and leading/trailing separators are stripped as;. It then setsROS_OS_OVERRIDE,ROS_ETC_DIR,AMENT_PREFIX_PATHandAMENT_PYTHON_EXECUTABLElikeactivate.bat. The Unix branch is unchanged (only re-indented).deactivate.sh.in: on Windows, also unsets what the Windows branch sets (asdeactivate.bat).Testing: only emulated, not yet on real Windows.
generate_template;bash -n,dash -nandzsh -npass.ros_workspace/ros_environmentpackages, withOSTYPE=msys, a fakecygpathand apython.exestand-in emitting Windows paths with CRLF line endings. It setsROS_DISTRO,ROS_VERSION,ROS_PYTHON_VERSION,AMENT_PREFIX_PATH,PYTHONPATHand the rest; activating twice adds no duplicates; deactivation clears them. The Unix branch behaves as before against the linux-64 package.find_package(rclcpp)from the issue) before merging.Not covered here: PowerShell (RoboStack/ros-humble#108).
activate.ps1callsLibrary\local_setup.ps1, which isn't installed (ament generates only.baton Windows), soROS_DISTRO/ROS_VERSION/PYTHONPATHaren't set there either; that needs a separate fix.Once merged: bump the vinca pin in RoboStack/robostack and
ros_workspace's build number per distribution.🤖 Generated with Claude Code