Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 from catkin_pkg.packages import find_packages
00011 
00012 
00013 
00014 
00015 
00016 
00017 def package_index_from_package_path(package_paths):
00018     """Find all packages on the given list of paths
00019 
00020     Iterates over the given list of paths in reverse order so that packages
00021     found in the paths at the beginning of the list get overlaid onto packages
00022     with the same name which were found in paths farther back in the list.
00023 
00024     The resulting dictionary is keyed by the package name (so packages with
00025     duplicate names are overlaid) and the values are the
00026     :py:class:`catkin_pkg.package.Package` class
00027 
00028     @note Is this actually implemented as a function in a general ros package?
00029 
00030     :param ros_package_path: list of paths to search
00031     :type ros_package_path: list
00032     :returns: dictionary of package objects keyed by name of the package
00033     :rtype: dict
00034     """
00035     result = {}
00036     for path in reversed(package_paths):
00037         for unused_package_path, package in find_packages(path).items():
00038             result[package.name] = package
00039     return result