def list_stacks_by_path(path, stacks=None, cache=None):
 if (stacks is None):
  stacks = []
 MANIFEST_FILE = rospkg.MANIFEST_FILE
 basename = os.path.basename
 for (d, dirs, files) in os.walk(path, topdown=True):
  if (STACK_FILE in files):
   stack = basename(d)
   if (stack not in stacks):
    stacks.append(stack)
    if (cache is not None):
     cache[stack] = d
   del dirs[:]
   continue
  elif (MANIFEST_FILE in files):
   del dirs[:]
   continue
  elif ('rospack_nosubdirs' in files):
   del dirs[:]
   continue
  [dirs.remove(di) for di in dirs if (di[0] == '.')]
  for sub_d in dirs:
   sub_p = os.path.join(d, sub_d)
   if os.path.islink(sub_p):
    stacks.extend(list_stacks_by_path(sub_p, cache=cache))
 return stacks

def list_stacks_by_path ( path , stacks = None , cache = None ) : if ( stacks is None ) : stacks = [ ] MANIFEST_FILE = rospkg . MANIFEST_FILE basename = os . path . basename for ( d , dirs , files ) in os . walk ( path , topdown = True ) : if ( STACK_FILE in files ) : stack = basename ( d ) if ( stack not in stacks ) : stacks . append ( stack ) if ( cache is not None ) : cache [ stack ] = d del dirs [ : ] continue elif ( MANIFEST_FILE in files ) : del dirs [ : ] continue elif ( 'rospack_nosubdirs' in files ) : del dirs [ : ] continue [ dirs . remove ( di ) for di in dirs if ( di [ 0 ] == '.' ) ] for sub_d in dirs : sub_p = os . path . join ( d , sub_d ) if os . path . islink ( sub_p ) : stacks . extend ( list_stacks_by_path ( sub_p , cache = cache ) ) return stacks
list ros stacks within the specified path .