moved env hooks to ros which is not a metapackage anymore

This commit is contained in:
Dirk Thomas 2012-09-26 22:54:45 +00:00
parent 0c7ea3a53a
commit e5689f2ed9
4 changed files with 84 additions and 4 deletions

6
ros/CMakeLists.txt Normal file
View File

@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 2.8)
project(ros)
find_package(catkin REQUIRED)
catkin_package()
catkin_add_env_hooks(10.ros SHELLS bat sh DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)

View File

@ -0,0 +1,37 @@
REM generated from ros/env-hooks/10.ros.bat.in
REM scrub old ROS bin dirs, to avoid accidentally finding the wrong executables
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])]))"`
set ROS_DISTRO=groovy
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 [@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@/@CATKIN_PACKAGE_ETC_DESTINATION@
)
if [@INSTALLSPACE@]==[true] (
set ROS_PACKAGE_PATH=@CMAKE_INSTALL_PREFIX@/share:@CMAKE_INSTALL_PREFIX@/stacks$ROS_PACKAGE_PATH_PARENTS
set ROS_ROOT=@CMAKE_INSTALL_PREFIX@/@CATKIN_PACKAGE_SHARE_DESTINATION@
set ROS_ETC_DIR=@CMAKE_INSTALL_PREFIX@/@CATKIN_PACKAGE_ETC_DESTINATION@
)
del _parent_package_path.py
endlocal

View File

@ -0,0 +1,39 @@
# generated from ros/env-hooks/10.ros.sh.in
# scrub old ROS bin dirs, to avoid accidentally finding the wrong executables
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
# 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 = 'CMAKE_PREFIX_PATH'
paths = [path for path in os.environ[env_name].split(os.pathsep)] if env_name in os.environ and os.environ[env_name] != '' else []
workspaces = [path for path in paths if os.path.exists(os.path.join(path, '.CATKIN_WORKSPACE'))]
paths = []
for workspace in workspaces:
filename = os.path.join(workspace, '.CATKIN_WORKSPACE')
data = ''
with open(filename) as f:
data = f.read()
if data == '':
paths.append(os.path.join(workspace, 'share'))
paths.append(os.path.join(workspace, 'stacks'))
else:
for source_path in data.split(';'):
paths.append(source_path)
print(os.pathsep.join(paths))
EOF
)
export ROS_PACKAGE_PATH=`python -c "$PYTHON_CODE_BUILD_ROS_PACKAGE_PATH"`
if @BUILDSPACE@; then
export ROS_ROOT=@CMAKE_CURRENT_SOURCE_DIR@
export ROS_ETC_DIR=@CATKIN_BUILD_PREFIX@/@CATKIN_PACKAGE_ETC_DESTINATION@
fi
if @INSTALLSPACE@; then
export ROS_ROOT=@CMAKE_INSTALL_PREFIX@/@CATKIN_PACKAGE_SHARE_DESTINATION@
export ROS_ETC_DIR=@CMAKE_INSTALL_PREFIX@/@CATKIN_PACKAGE_ETC_DESTINATION@
fi

View File

@ -18,6 +18,8 @@
<author>Morgan Quigley</author>
<author>Rob Wheeler</author>
<build_depend>catkin</build_depend>
<run_depend>mk</run_depend>
<run_depend>rosbuild</run_depend>
<run_depend>roslang</run_depend>
@ -28,8 +30,4 @@
<run_depend>roscreate</run_depend>
<run_depend>rosmake</run_depend>
<run_depend>rosunit</run_depend>
<export>
<metapackage/>
</export>
</package>