Skip to content

Commit

Permalink
ensure to only return unique source paths from a workspace marker file (
Browse files Browse the repository at this point in the history
fix #424)
  • Loading branch information
dirk-thomas committed May 22, 2013
1 parent 7247e4e commit ff720ae
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions python/catkin/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,18 @@ def get_source_paths(workspace):
:param workspace: path to catkin workspace folder, ``str``
"""
# determine source spaces
data = ''
filename = os.path.join(workspace, CATKIN_MARKER_FILE)
if not os.path.isfile(filename):
raise ValueError('Not a catkin workspace: "%s", missing file %s' % (workspace, filename))
with open(filename) as f:
data = f.read()

if data == '':
source_paths = []
else:
source_paths = data.split(';')
source_paths = []
if data != '':
real_source_paths = set([])
for path in data.split(';'):
real_path = os.path.realpath(path)
if real_path not in real_source_paths:
source_paths.append(path)
real_source_paths.add(real_path)
return source_paths

0 comments on commit ff720ae

Please sign in to comment.