示例#1
0
 def test_get_spaces(self):
     self.assertEqual([], get_spaces([]))
     try:
         root_dir = tempfile.mkdtemp()
         self.assertEqual([], get_spaces([root_dir]))
         with open(os.path.join(root_dir, '.catkin'), 'a') as fhand:
             fhand.write('')
         self.assertEqual([root_dir], get_spaces([root_dir]))
     finally:
         shutil.rmtree(root_dir)
示例#2
0
 def test_get_spaces(self):
     self.assertEqual([], get_spaces([]))
     try:
         root_dir = tempfile.mkdtemp()
         self.assertEqual([], get_spaces([root_dir]))
         with open(os.path.join(root_dir, '.catkin'), 'a') as fhand:
             fhand.write('')
         self.assertEqual([root_dir], get_spaces([root_dir]))
     finally:
         shutil.rmtree(root_dir)
示例#3
0
def get_pkg_map():
    pkg_map = {}
    for ws in workspaces.get_spaces():
        pkgs = packages.find_packages(ws)
        for pkg in pkgs.values():
            pkg_map[pkg.name] = pkg
    return pkg_map
示例#4
0
def get_pkg_map():
    from catkin_pkg import packages, workspaces
    pkg_map = {}
    for ws in workspaces.get_spaces():
        pkgs = packages.find_packages(ws)
        for pkg in pkgs.values():
            if not pkg_map.has_key(pkg.name):
                pkg_map[pkg.name] = pkg
    return pkg_map
示例#5
0
def get_pkg_map():
    pkg_map = {}
    for ws in workspaces.get_spaces():
        pkgs = packages.find_packages(ws)
        for pkg in pkgs.values():
            # packages.find_packages(workspaces.get_spaces()) returns package in high-priority-first-order, so we should not overwirte package map which is already found
            # https://github.com/ros-infrastructure/catkin_pkg/blob/fa4b136b16e2d2886ab97257684f6bff243edefb/src/catkin_pkg/workspaces.py#L43
            # https://github.com/ros-infrastructure/catkin_pkg/blob/fa4b136b16e2d2886ab97257684f6bff243edefb/src/catkin_pkg/packages.py#L71
            if pkg.name not in pkg_map:
                pkg_map[pkg.name] = pkg
    return pkg_map
示例#6
0
def get_pkg_map():
    pkg_map = {}
    for ws in workspaces.get_spaces():
        pkgs = packages.find_packages(ws)
        for pkg in pkgs.values():
            # packages.find_packages(workspaces.get_spaces()) returns package in high-priority-first-order, so we should not overwirte package map which is already found
            # https://github.com/ros-infrastructure/catkin_pkg/blob/fa4b136b16e2d2886ab97257684f6bff243edefb/src/catkin_pkg/workspaces.py#L43
            # https://github.com/ros-infrastructure/catkin_pkg/blob/fa4b136b16e2d2886ab97257684f6bff243edefb/src/catkin_pkg/packages.py#L71
            if pkg.name not in pkg_map:
                pkg_map[pkg.name] = pkg
    return pkg_map
示例#7
0
def main():
    """Order a list of paths according to a list of prefixes which define the order."""
    parser = ArgumentParser(description='Utility to order a list of paths according to a list of prefixes. Creates a file with CMake set command setting a variable.')
    parser.add_argument('outfile', help='The filename of the generated CMake file')
    parser.add_argument('--paths-to-order', nargs='*', help='The semicolon-separated paths to order')
    parser.add_argument('--prefixes', nargs='*', help='The semicolon-separated prefixes defining the order')
    args = parser.parse_args()

    # resolve the source space if any
    spaces = []
    for prefix in args.prefixes:
        spaces.append(prefix)
        spaces += get_spaces([prefix])

    ordered_paths = order_paths(args.paths_to_order, spaces)

    # create directory if necessary
    outdir = os.path.dirname(args.outfile)
    if not os.path.exists(outdir):
        os.makedirs(outdir)

    with open(args.outfile, 'w') as fh:
        fh.write('set(ORDERED_PATHS "%s")' % ';'.join(ordered_paths))