Skip to content

Commit

Permalink
normalize list of uninstalled to single list of str (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjwwood authored Jul 18, 2017
1 parent b1de10c commit 2e95fab
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 18 additions & 2 deletions src/rosdep2/installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,18 @@ def get_depends(self, rosdep_args):
return rosdep_args.get('depends', [])
return [] # Default return empty list


def normalize_uninstalled_to_list(uninstalled):
uninstalled_dependencies = []
for pkg_or_list in [v for k, v in uninstalled]:
if isinstance(pkg_or_list, list):
for pkg in pkg_or_list:
uninstalled_dependencies.append(str(pkg))
else:
uninstalled_dependencies.append(str(pkg))
return uninstalled_dependencies


class RosdepInstaller(object):

def __init__(self, installer_context, lookup):
Expand Down Expand Up @@ -484,8 +496,12 @@ def install(self, uninstalled, interactive=True, simulate=False,
installer.install(uninstalled)
"""
if verbose:
print("install options: reinstall[%s] simulate[%s] interactive[%s]"%(reinstall, simulate, interactive))
print("install: uninstalled keys are %s"%(', '.join([', '.join(pkg) for pkg in [v for k,v in uninstalled]])))
print(
"install options: reinstall[%s] simulate[%s] interactive[%s]" %
(reinstall, simulate, interactive)
)
uninstalled_list = normalize_uninstalled_to_list(uninstalled)
print("install: uninstalled keys are %s" % ', '.join(uninstalled_list))

# Squash uninstalled again, in case some dependencies were already installed
squashed_uninstalled = []
Expand Down
4 changes: 3 additions & 1 deletion src/rosdep2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
from . import create_default_installer_context, get_default_installer
from . import __version__
from .core import RosdepInternalError, InstallFailed, UnsupportedOs, InvalidData, CachePermissionError
from .installers import normalize_uninstalled_to_list
from .installers import RosdepInstaller
from .lookup import RosdepLookup, ResolutionError
from .rospkg_loader import DEFAULT_VIEW_KEY
Expand Down Expand Up @@ -660,7 +661,8 @@ def command_install(lookup, packages, options):
uninstalled, errors = installer.get_uninstalled(packages, implicit=options.recursive, verbose=options.verbose)

if options.verbose:
print("uninstalled dependencies are: [%s]"%(', '.join([', '.join(pkg) for pkg in [v for k,v in uninstalled]])))
uninstalled_dependencies = normalize_uninstalled_to_list(uninstalled)
print("uninstalled dependencies are: [%s]" % ', '.join(uninstalled_dependencies))

if errors:
err_msg = ("ERROR: the following packages/stacks could not have their "
Expand Down

0 comments on commit 2e95fab

Please sign in to comment.