Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalize list of uninstalled to single list of str #525

Merged
merged 1 commit into from
Jul 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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