1# Copyright (c) 2012 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import command_common
6import logging
7import manifest_util
8
9def Info(manifest, bundle_names):
10  valid_bundles, invalid_bundles = command_common.GetValidBundles(manifest,
11                                                                  bundle_names)
12  if invalid_bundles:
13    logging.warn('Unknown bundle(s): %s\n' % (', '.join(invalid_bundles)))
14
15  if not valid_bundles:
16    logging.warn('No valid bundles given.')
17    return
18
19  for bundle_name in valid_bundles:
20    bundle = manifest.GetBundle(bundle_name)
21
22    print bundle.name
23    for key in sorted(bundle.iterkeys()):
24      value = bundle[key]
25      if key == manifest_util.ARCHIVES_KEY:
26        for archive in bundle.GetArchives():
27          print '  Archive:'
28          if archive:
29            for archive_key in sorted(archive.iterkeys()):
30              print '    %s: %s' % (archive_key, archive[archive_key])
31      elif key not in (manifest_util.ARCHIVES_KEY, manifest_util.NAME_KEY):
32        print '  %s: %s' % (key, value)
33    print
34