Skip to content

Commit

Permalink
Help find catkin python for install underlays
Browse files Browse the repository at this point in the history
This is a follow on from ros#397
  • Loading branch information
stonier committed May 1, 2013
1 parent 5e89a61 commit 6dd0225
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmake/templates/generate_cached_setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@ import os
import stat
import sys

# find the import relatively if available to work before installing catkin or overlaying installed version
# find the import for catkin's python package - either from source space or from an installed underlay
if os.path.exists(os.path.join('@catkin_EXTRAS_DIR@', 'catkinConfig.cmake.in')):
sys.path.insert(0, os.path.join('@catkin_EXTRAS_DIR@', '..', 'python'))
from catkin.environment_cache import generate_environment_script
try:
from catkin.environment_cache import generate_environment_script
except ImportError:
# search for catkin package in all workspaces and prepend to path
for workspace in "@CATKIN_WORKSPACES@".split(';'):
python_path = os.path.join(workspace, '@CATKIN_GLOBAL_PYTHON_DESTINATION@')
if os.path.isdir(os.path.join(python_path, 'catkin')):
sys.path.insert(0, python_path)
break
from catkin.environment_cache import generate_environment_script

code = generate_environment_script('@CATKIN_DEVEL_PREFIX@/env.@script_ext@')

Expand Down

0 comments on commit 6dd0225

Please sign in to comment.