Skip to content

Commit

Permalink
0.9.0: rosdep by default is no longer recursive, invoke with -R to be…
Browse files Browse the repository at this point in the history
… recursive
  • Loading branch information
Ken Conley committed Mar 6, 2012
1 parent 044a9ed commit 2b2aad8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
4 changes: 4 additions & 0 deletions doc/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,7 @@ Install Options

Continue installing despite errors.

**-R**

Install implicit/recursive dependencies.

5 changes: 5 additions & 0 deletions doc/man/rosdep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,8 @@ Install Options
**-r**

Continue installing despite errors.

**-R**

Install implicit/recursive dependencies.

2 changes: 1 addition & 1 deletion src/rosdep2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

from __future__ import print_function

__version__ = '0.8.7'
__version__ = '0.9.0'

import sys

Expand Down
6 changes: 4 additions & 2 deletions src/rosdep2/installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,16 @@ 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.
This is a bulk API in order to provide performance
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.
Expand All @@ -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 = {}
Expand Down
7 changes: 5 additions & 2 deletions src/rosdep2/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions src/rosdep2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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())))
Expand Down

0 comments on commit 2b2aad8

Please sign in to comment.