parameters: (manifest_name, path, cache)
return_statement: return resources
docstring: List ROS stacks or packages within the specified path.
  
      The cache will be updated with the resource->path
      mappings. list_by_path() does NOT returned cached results
      -- it only updates the cache.
      
      :param manifest_name: MANIFEST_FILE or STACK_FILE, ``str``
      :param path: path to list resources in, ``str``
      :param cache: path cache to update. Maps resource name to directory path, ``{str: str}``
      :returns: complete list of resources in ROS environment, ``[str]``
docstring_summary: List ROS stacks or packages within the specified path.
docstring_tokens: List ROS stacks or packages within the specified path .
function: def list_by_path(manifest_name, path, cache):
      """
      List ROS stacks or packages within the specified path.
  
      The cache will be updated with the resource->path
      mappings. list_by_path() does NOT returned cached results
      -- it only updates the cache.
      
      :param manifest_name: MANIFEST_FILE or STACK_FILE, ``str``
      :param path: path to list resources in, ``str``
      :param cache: path cache to update. Maps resource name to directory path, ``{str: str}``
      :returns: complete list of resources in ROS environment, ``[str]``
      """
      resources = []
      path = os.path.abspath(path)
      basename = os.path.basename
      for d, dirs, files in os.walk(path, topdown=True, followlinks=True):
          if 'CATKIN_IGNORE' in files:
              del dirs[:]
              continue  #leaf
          if PACKAGE_FILE in files:
              # parse package.xml and decide if it matches the search criteria
              root = ElementTree(None, os.path.join(d, PACKAGE_FILE))
              is_metapackage = root.find('./export/metapackage') is not None
              if ((manifest_name == STACK_FILE and is_metapackage) or
                  (manifest_name == MANIFEST_FILE and not is_metapackage) or
                  manifest_name == PACKAGE_FILE):
                  resource_name = root.findtext('name').strip(' \n\r\t')
                  if resource_name not in resources:
                      resources.append(resource_name)
                      if cache is not None:
                          cache[resource_name] = d
                  del dirs[:]
                  continue #leaf
          if manifest_name in files:
              resource_name = basename(d)
              if resource_name not in resources:
                  resources.append(resource_name)
                  if cache is not None:
                      cache[resource_name] = d
              del dirs[:]
              continue #leaf
          elif MANIFEST_FILE in files or PACKAGE_FILE in files:
              # noop if manifest_name==MANIFEST_FILE, but a good
              # optimization for stacks.
              del dirs[:]
              continue #leaf     
          elif 'rospack_nosubdirs' in files:
              del dirs[:]
              continue  #leaf
          # remove hidden dirs (esp. .svn/.git)
          [dirs.remove(di) for di in dirs if di[0] == '.']
      return resources
function_tokens: def list_by_path ( manifest_name , path , cache ) : resources = [ ] path = os . path . abspath ( path ) basename = os . path . basename for d , dirs , files in os . walk ( path , topdown = True , followlinks = True ) : if 'CATKIN_IGNORE' in files : del dirs [ : ] continue #leaf if PACKAGE_FILE in files : # parse package.xml and decide if it matches the search criteria root = ElementTree ( None , os . path . join ( d , PACKAGE_FILE ) ) is_metapackage = root . find ( './export/metapackage' ) is not None if ( ( manifest_name == STACK_FILE and is_metapackage ) or ( manifest_name == MANIFEST_FILE and not is_metapackage ) or manifest_name == PACKAGE_FILE ) : resource_name = root . findtext ( 'name' ) . strip ( ' \n\r\t' ) if resource_name not in resources : resources . append ( resource_name ) if cache is not None : cache [ resource_name ] = d del dirs [ : ] continue #leaf if manifest_name in files : resource_name = basename ( d ) if resource_name not in resources : resources . append ( resource_name ) if cache is not None : cache [ resource_name ] = d del dirs [ : ] continue #leaf elif MANIFEST_FILE in files or PACKAGE_FILE in files : # noop if manifest_name==MANIFEST_FILE, but a good # optimization for stacks. del dirs [ : ] continue #leaf      elif 'rospack_nosubdirs' in files : del dirs [ : ] continue #leaf # remove hidden dirs (esp. .svn/.git) [ dirs . remove ( di ) for di in dirs if di [ 0 ] == '.' ] return resources