Skip to content

Commit

Permalink
fix Python environment to make it work on the first run
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Mar 15, 2016
1 parent 5f40686 commit 3c5066e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmake/dynamic_reconfigure-macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,22 @@ macro(generate_dynamic_reconfigure_options)
set(_output_wikidoc ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/docs/${_cfgonly}Config.wikidoc)
set(_output_usage ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/docs/${_cfgonly}Config-usage.dox)

# in case dynamic_reconfigure has been built within the same CMake context
# we need to explicitly add it to the PYTHONPATH
set("_CUSTOM_PYTHONPATH_ENV")
if(EXISTS "${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}/dynamic_reconfigure")
configure_file(
"${dynamic_reconfigure_BASE_DIR}/cmake/setup_custom_pythonpath.sh.in"
"setup_custom_pythonpath.sh"
@ONLY
)
set("_CUSTOM_PYTHONPATH_ENV" "${CMAKE_CURRENT_BINARY_DIR}/setup_custom_pythonpath.sh")
endif()

assert(CATKIN_ENV)
set(_cmd
PYTHONPATH=${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_PYTHON_DESTINATION}:$ENV{PYTHONPATH}
${CATKIN_ENV}
${_CUSTOM_PYTHONPATH_ENV}
${_input}
${dynamic_reconfigure_BASE_DIR}
${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}
Expand Down
4 changes: 4 additions & 0 deletions cmake/setup_custom_pythonpath.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# generated from dynamic_reconfigure/cmake/setup_custom_pythonpath.sh.in

PYTHONPATH=@CATKIN_DEVEL_PREFIX@/@CATKIN_GLOBAL_PYTHON_DESTINATION@:$PYTHONPATH
exec "$@"

0 comments on commit 3c5066e

Please sign in to comment.