diff --git a/doc/commands.rst b/doc/commands.rst index a46644208..74cf95089 100644 --- a/doc/commands.rst +++ b/doc/commands.rst @@ -107,3 +107,7 @@ Install Options Continue installing despite errors. +**-R** + + Install implicit/recursive dependencies. + diff --git a/doc/man/rosdep.rst b/doc/man/rosdep.rst index f2c5679f1..2dbd43523 100644 --- a/doc/man/rosdep.rst +++ b/doc/man/rosdep.rst @@ -104,3 +104,8 @@ Install Options **-r** Continue installing despite errors. + +**-R** + + Install implicit/recursive dependencies. + diff --git a/src/rosdep2/__init__.py b/src/rosdep2/__init__.py index 2f7a05727..3d4c9f3ea 100644 --- a/src/rosdep2/__init__.py +++ b/src/rosdep2/__init__.py @@ -33,7 +33,7 @@ from __future__ import print_function -__version__ = '0.8.7' +__version__ = '0.9.0' import sys diff --git a/src/rosdep2/installers.py b/src/rosdep2/installers.py index 4f7ca0c36..27d23e027 100644 --- a/src/rosdep2/installers.py +++ b/src/rosdep2/installers.py @@ -382,7 +382,7 @@ def __init__(self, installer_context, lookup): self.installer_context = installer_context self.lookup = lookup - def get_uninstalled(self, resources, verbose=False): + def get_uninstalled(self, resources, implicit=False, verbose=False): """ Get list of system dependencies that have not been installed as well as a list of errors from performing the resolution. @@ -390,6 +390,8 @@ def get_uninstalled(self, resources, verbose=False): optimizations in checking install state. :param resources: List of resource names (e.g. ROS package names), ``[str]]`` + :param implicit: Install implicit (recursive) dependencies of + resources. Default ``False``. :returns: (uninstalled, errors), ``({str: [opaque]}, {str: ResolutionError})``. Uninstalled is a dictionary with the installer_key as the key. @@ -401,7 +403,7 @@ def get_uninstalled(self, resources, verbose=False): # resolutions have been unique()d if verbose: print("resolving for resources [%s]"%(', '.join(resources))) - resolutions, errors = self.lookup.resolve_all(resources, installer_context) + resolutions, errors = self.lookup.resolve_all(resources, installer_context, implicit=implicit) # for each installer, figure out what is left to install uninstalled = {} diff --git a/src/rosdep2/lookup.py b/src/rosdep2/lookup.py index a36c981db..e7f11e26e 100644 --- a/src/rosdep2/lookup.py +++ b/src/rosdep2/lookup.py @@ -305,12 +305,15 @@ def create_from_rospkg(rospack=None, rosstack=None, return lookup - def resolve_all(self, resources, installer_context): + def resolve_all(self, resources, installer_context, implicit=False): """ Resolve all the rosdep dependencies for *resources* using *installer_context*. :param resources: list of resources (e.g. packages), ``[str]]`` :param installer_context: :class:`InstallerContext` + :param implicit: Install implicit (recursive) dependencies of + resources. Default ``False``. + :returns: (resolutions, errors), ``({str: opaque}, {str: ResolutionError})``. resolutions maps the installer keys to resolved objects. Resolved objects are opaque but can be passed into the associated installer for processing. errors maps package names to an :exc:`ResolutionError` or :exc:`KeyError` exception. @@ -319,7 +322,7 @@ def resolve_all(self, resources, installer_context): errors = {} for resource_name in resources: try: - rosdep_keys = self.get_rosdeps(resource_name, implicit=True) + rosdep_keys = self.get_rosdeps(resource_name, implicit=implicit) if self.verbose: print("resolve_all: resource [%s] requires rosdep keys [%s]"%(resource_name, ', '.join(rosdep_keys)), file=sys.stderr) for rosdep_key in rosdep_keys: diff --git a/src/rosdep2/main.py b/src/rosdep2/main.py index a6b131832..d2d9fc318 100644 --- a/src/rosdep2/main.py +++ b/src/rosdep2/main.py @@ -201,6 +201,8 @@ def _rosdep_main(args): action="store_true", help="Continue installing despite errors.") parser.add_option("-a", "--all", dest="rosdep_all", default=False, action="store_true", help="select all packages") + parser.add_option("-R", dest="recursive", default=False, + action="store_true", help="Install implicit/recursive dependencies. Only valid with 'install' command.") options, args = parser.parse_args(args) if options.print_version: @@ -400,9 +402,9 @@ def command_install(lookup, packages, options): if options.reinstall: if options.verbose: print("reinstall is true, resolving all dependencies") - uninstalled, errors = lookup.resolve_all(packages, installer_context) + uninstalled, errors = lookup.resolve_all(packages, installer_context, implicit=options.recursive) else: - uninstalled, errors = installer.get_uninstalled(packages, verbose=options.verbose) + uninstalled, errors = installer.get_uninstalled(packages, implicit=options.recursive, verbose=options.verbose) if options.verbose: print("uninstalled dependencies are: [%s]"%(', '.join(uninstalled.keys())))