<s> from __future__ import print_function <EOL> import os <EOL> CATKIN_MARKER_FILE = '<STR_LIT>' <EOL> def get_workspaces ( ) : <EOL> """<STR_LIT>""" <EOL> env_name = '<STR_LIT>' <EOL> paths = [ path for path in os . environ . get ( env_name , '<STR_LIT>' ) . split ( os . pathsep ) if path ] <EOL> workspaces = [ path for path in paths if os . path . isfile ( os . path . join ( path , CATKIN_MARKER_FILE ) ) ] <EOL> return workspaces <EOL> def get_source_paths ( workspace ) : <EOL> """<STR_LIT>""" <EOL> filename = os . path . join ( workspace , CATKIN_MARKER_FILE ) <EOL> if not os . path . isfile ( filename ) : <EOL> raise ValueError ( '<STR_LIT>' % ( workspace , filename ) ) <EOL> with open ( filename ) as f : <EOL> data = f . read ( ) <EOL> source_paths = [ ] <EOL> if data != '<STR_LIT>' : <EOL> real_source_paths = set ( [ ] ) <EOL> for path in data . split ( '<STR_LIT:;>' ) : <EOL> real_path = os . path . realpath ( path ) <EOL> if real_path not in real_source_paths : <EOL> source_paths . append ( path ) <EOL> real_source_paths . add ( real_path ) <EOL> return source_paths </s>
