@@ -72,42 +72,42 @@ def rollback_env_variables(environ, env_var_subfolders):
7272 subfolders = env_var_subfolders [key ]
7373 if not isinstance (subfolders , list ):
7474 subfolders = [subfolders ]
75- for subfolder in subfolders :
76- value = _rollback_env_variable (unmodified_environ , key , subfolder )
77- if value is not None :
78- environ [key ] = value
79- lines .append (assignment (key , value ))
75+ value = _rollback_env_variable (unmodified_environ , key , subfolders )
76+ if value is not None :
77+ environ [key ] = value
78+ lines .append (assignment (key , value ))
8079 if lines :
8180 lines .insert (0 , comment ('reset environment variables by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH' ))
8281 return lines
8382
8483
85- def _rollback_env_variable (environ , name , subfolder ):
84+ def _rollback_env_variable (environ , name , subfolders ):
8685 '''
8786 For each catkin workspace in CMAKE_PREFIX_PATH remove the first entry from env[NAME] matching workspace + subfolder.
8887
89- :param subfolder: str '' or subfoldername that may start with '/'
88+ :param subfolders: list of str '' or subfoldername that may start with '/'
9089 :returns: the updated value of the environment variable.
9190 '''
9291 value = environ [name ] if name in environ else ''
9392 env_paths = [path for path in value .split (os .pathsep ) if path ]
9493 value_modified = False
95- if subfolder :
96- if subfolder .startswith (os .path .sep ) or (os .path .altsep and subfolder .startswith (os .path .altsep )):
97- subfolder = subfolder [1 :]
98- if subfolder .endswith (os .path .sep ) or (os .path .altsep and subfolder .endswith (os .path .altsep )):
99- subfolder = subfolder [:- 1 ]
100- for ws_path in _get_workspaces (environ , include_fuerte = True , include_non_existing = True ):
101- path_to_find = os .path .join (ws_path , subfolder ) if subfolder else ws_path
102- path_to_remove = None
103- for env_path in env_paths :
104- env_path_clean = env_path [:- 1 ] if env_path and env_path [- 1 ] in [os .path .sep , os .path .altsep ] else env_path
105- if env_path_clean == path_to_find :
106- path_to_remove = env_path
107- break
108- if path_to_remove :
109- env_paths .remove (path_to_remove )
110- value_modified = True
94+ for subfolder in subfolders :
95+ if subfolder :
96+ if subfolder .startswith (os .path .sep ) or (os .path .altsep and subfolder .startswith (os .path .altsep )):
97+ subfolder = subfolder [1 :]
98+ if subfolder .endswith (os .path .sep ) or (os .path .altsep and subfolder .endswith (os .path .altsep )):
99+ subfolder = subfolder [:- 1 ]
100+ for ws_path in _get_workspaces (environ , include_fuerte = True , include_non_existing = True ):
101+ path_to_find = os .path .join (ws_path , subfolder ) if subfolder else ws_path
102+ path_to_remove = None
103+ for env_path in env_paths :
104+ env_path_clean = env_path [:- 1 ] if env_path and env_path [- 1 ] in [os .path .sep , os .path .altsep ] else env_path
105+ if env_path_clean == path_to_find :
106+ path_to_remove = env_path
107+ break
108+ if path_to_remove :
109+ env_paths .remove (path_to_remove )
110+ value_modified = True
111111 new_value = os .pathsep .join (env_paths )
112112 return new_value if value_modified else None
113113
@@ -263,7 +263,7 @@ def _parse_arguments(args=None):
263263 sys .exit (1 )
264264
265265 # environment at generation time
266- CMAKE_PREFIX_PATH = '/home/mac/Developer/ros-examples/devel;/ opt/ros/indigo' .split (';' )
266+ CMAKE_PREFIX_PATH = '/opt/ros/indigo' .split (';' )
267267 # prepend current workspace if not already part of CPP
268268 base_path = os .path .dirname (__file__ )
269269 if base_path not in CMAKE_PREFIX_PATH :
0 commit comments