fixed ROS_PACKAGE_PATH to include all workspaces
This commit is contained in:
parent
a8025a3dc0
commit
3b26c7d733
|
@ -1,20 +1,40 @@
|
|||
REM generated from ros/env-hooks/10.ros.bat.in
|
||||
|
||||
REM scrub old ROS bin dirs, to avoid accidentally finding the wrong executables
|
||||
PATH=`python -c "import os; print(os.pathsep.join([x for x in \"$PATH\".split(os.pathsep) if not any([d for d in ['cturtle', 'diamondback', 'electric', 'fuerte'] if d in x])]))"`
|
||||
set PATH=`python -c "import os; print(os.pathsep.join([x for x in \"$PATH\".split(os.pathsep) if not any([d for d in ['cturtle', 'diamondback', 'electric', 'fuerte'] if d in x])]))"`
|
||||
|
||||
export ROS_DISTRO=groovy
|
||||
if "%ROS_MASTER_URI%" EQ "" (
|
||||
export ROS_MASTER_URI=http://localhost:11311
|
||||
set ROS_DISTRO=groovy
|
||||
if [%ROS_MASTER_URI]==[] (
|
||||
set ROS_MASTER_URI=http://localhost:11311
|
||||
)
|
||||
|
||||
if @ENV_BUILDSPACE@ (
|
||||
export ROS_PACKAGE_PATH=@CMAKE_SOURCE_DIR@
|
||||
export ROS_ROOT=@CMAKE_CURRENT_SOURCE_DIR@
|
||||
export ROS_ETC_DIR=@catkin_BUILD_PREFIX@/etc/ros
|
||||
REM python function to generate ROS package path based on all parent workspaces (prepends the separator if necessary)
|
||||
REM do not use EnableDelayedExpansion here, it messes with the != symbols
|
||||
echo from __future__ import print_function > _parent_package_path.py
|
||||
echo import os >> _parent_package_path.py
|
||||
echo env_name = 'CATKIN_WORKSPACES' >> _parent_package_path.py
|
||||
echo items = os.environ[env_name].split(';') if env_name in os.environ and os.environ[env_name] != '' else [] >> _parent_package_path.py
|
||||
echo path = '' >> _parent_package_path.py
|
||||
echo for item in items: >> _parent_package_path.py
|
||||
echo path += ':' + (os.path.join(item, 'share') if item.find(':') == -1 else item.split(':')[1]) >> _parent_package_path.py
|
||||
echo print(path) >> _parent_package_path.py
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set ROS_PACKAGE_PATH_PARENTS=
|
||||
for /f %%a in ('python _parent_package_path.py') do set ROS_PACKAGE_PATH_PARENTS=!ROS_PACKAGE_PATH_PARENTS!%%a
|
||||
|
||||
if [@ENV_BUILDSPACE@]==[true] (
|
||||
set ROS_PACKAGE_PATH=@CMAKE_SOURCE_DIR@$ROS_PACKAGE_PATH_PARENTS
|
||||
set ROS_ROOT=@CMAKE_CURRENT_SOURCE_DIR@
|
||||
set ROS_ETC_DIR=@catkin_BUILD_PREFIX@/etc/ros
|
||||
)
|
||||
if @ENV_INSTALLSPACE@ (
|
||||
export ROS_PACKAGE_PATH=@CMAKE_INSTALL_PREFIX@/share:@CMAKE_INSTALL_PREFIX@/stacks
|
||||
export ROS_ROOT=@CMAKE_INSTALL_PREFIX@/share/ros
|
||||
export ROS_ETC_DIR=@CMAKE_INSTALL_PREFIX@/etc/ros
|
||||
if [@ENV_INSTALLSPACE@]==[true] (
|
||||
set ROS_PACKAGE_PATH=@CMAKE_INSTALL_PREFIX@/share:@CMAKE_INSTALL_PREFIX@/stacks$ROS_PACKAGE_PATH_PARENTS
|
||||
set ROS_ROOT=@CMAKE_INSTALL_PREFIX@/share/ros
|
||||
set ROS_ETC_DIR=@CMAKE_INSTALL_PREFIX@/etc/ros
|
||||
)
|
||||
|
||||
del _parent_package_path.py
|
||||
|
||||
endlocal
|
||||
|
|
|
@ -1,20 +1,36 @@
|
|||
# generated from ros/env-hooks/10.ros.sh.in
|
||||
|
||||
# scrub old ROS bin dirs, to avoid accidentally finding the wrong executables
|
||||
PATH=`python -c "import os; print(os.pathsep.join([x for x in \"$PATH\".split(os.pathsep) if not any([d for d in ['cturtle', 'diamondback', 'electric', 'fuerte'] if d in x])]))"`
|
||||
export PATH=`python -c "import os; print(os.pathsep.join([x for x in \"$PATH\".split(os.pathsep) if not any([d for d in ['cturtle', 'diamondback', 'electric', 'fuerte'] if d in x])]))"`
|
||||
|
||||
export ROS_DISTRO=groovy
|
||||
if [ ! "$ROS_MASTER_URI" ] ; then
|
||||
export ROS_MASTER_URI=http://localhost:11311
|
||||
fi
|
||||
|
||||
# python function to generate ROS package path based on all workspaces
|
||||
PYTHON_CODE_BUILD_ROS_PACKAGE_PATH=$(cat <<EOF
|
||||
from __future__ import print_function
|
||||
import os
|
||||
env_name = 'CATKIN_WORKSPACES'
|
||||
items = os.environ[env_name].split(';') if env_name in os.environ and os.environ[env_name] != '' else []
|
||||
paths = []
|
||||
for item in items:
|
||||
if item.find(':') != -1:
|
||||
paths.append(item.split(':')[1])
|
||||
else:
|
||||
path.append(os.path.join(item, 'share'))
|
||||
path.append(os.path.join(item, 'stacks'))
|
||||
print(':'.join(paths))
|
||||
EOF
|
||||
)
|
||||
export ROS_PACKAGE_PATH=`python -c "$PYTHON_CODE_BUILD_ROS_PACKAGE_PATH"`
|
||||
|
||||
if @ENV_BUILDSPACE@; then
|
||||
export ROS_PACKAGE_PATH=@CMAKE_SOURCE_DIR@
|
||||
export ROS_ROOT=@CMAKE_CURRENT_SOURCE_DIR@
|
||||
export ROS_ETC_DIR=@catkin_BUILD_PREFIX@/etc/ros
|
||||
fi
|
||||
if @ENV_INSTALLSPACE@; then
|
||||
export ROS_PACKAGE_PATH=@CMAKE_INSTALL_PREFIX@/share:@CMAKE_INSTALL_PREFIX@/stacks
|
||||
export ROS_ROOT=@CMAKE_INSTALL_PREFIX@/share/ros
|
||||
export ROS_ETC_DIR=@CMAKE_INSTALL_PREFIX@/etc/ros
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue