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 generated from ros/env-hooks/10.ros.bat.in
|
||||||
|
|
||||||
REM scrub old ROS bin dirs, to avoid accidentally finding the wrong executables
|
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
|
set ROS_DISTRO=groovy
|
||||||
if "%ROS_MASTER_URI%" EQ "" (
|
if [%ROS_MASTER_URI]==[] (
|
||||||
export ROS_MASTER_URI=http://localhost:11311
|
set ROS_MASTER_URI=http://localhost:11311
|
||||||
)
|
)
|
||||||
|
|
||||||
if @ENV_BUILDSPACE@ (
|
REM python function to generate ROS package path based on all parent workspaces (prepends the separator if necessary)
|
||||||
export ROS_PACKAGE_PATH=@CMAKE_SOURCE_DIR@
|
REM do not use EnableDelayedExpansion here, it messes with the != symbols
|
||||||
export ROS_ROOT=@CMAKE_CURRENT_SOURCE_DIR@
|
echo from __future__ import print_function > _parent_package_path.py
|
||||||
export ROS_ETC_DIR=@catkin_BUILD_PREFIX@/etc/ros
|
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@ (
|
if [@ENV_INSTALLSPACE@]==[true] (
|
||||||
export ROS_PACKAGE_PATH=@CMAKE_INSTALL_PREFIX@/share:@CMAKE_INSTALL_PREFIX@/stacks
|
set ROS_PACKAGE_PATH=@CMAKE_INSTALL_PREFIX@/share:@CMAKE_INSTALL_PREFIX@/stacks$ROS_PACKAGE_PATH_PARENTS
|
||||||
export ROS_ROOT=@CMAKE_INSTALL_PREFIX@/share/ros
|
set ROS_ROOT=@CMAKE_INSTALL_PREFIX@/share/ros
|
||||||
export ROS_ETC_DIR=@CMAKE_INSTALL_PREFIX@/etc/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
|
# generated from ros/env-hooks/10.ros.sh.in
|
||||||
|
|
||||||
# scrub old ROS bin dirs, to avoid accidentally finding the wrong executables
|
# 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
|
export ROS_DISTRO=groovy
|
||||||
if [ ! "$ROS_MASTER_URI" ] ; then
|
if [ ! "$ROS_MASTER_URI" ] ; then
|
||||||
export ROS_MASTER_URI=http://localhost:11311
|
export ROS_MASTER_URI=http://localhost:11311
|
||||||
fi
|
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
|
if @ENV_BUILDSPACE@; then
|
||||||
export ROS_PACKAGE_PATH=@CMAKE_SOURCE_DIR@
|
|
||||||
export ROS_ROOT=@CMAKE_CURRENT_SOURCE_DIR@
|
export ROS_ROOT=@CMAKE_CURRENT_SOURCE_DIR@
|
||||||
export ROS_ETC_DIR=@catkin_BUILD_PREFIX@/etc/ros
|
export ROS_ETC_DIR=@catkin_BUILD_PREFIX@/etc/ros
|
||||||
fi
|
fi
|
||||||
if @ENV_INSTALLSPACE@; then
|
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_ROOT=@CMAKE_INSTALL_PREFIX@/share/ros
|
||||||
export ROS_ETC_DIR=@CMAKE_INSTALL_PREFIX@/etc/ros
|
export ROS_ETC_DIR=@CMAKE_INSTALL_PREFIX@/etc/ros
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue