| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 import json | 6 import json |
| 7 | 7 |
| 8 COMPONENTS_DIR = 'components-chromium' | 8 COMPONENTS_DIR = 'components' |
| 9 COMPONENT_SUMMARY =\ | 9 COMPONENT_SUMMARY =\ |
| 10 """Name: %(name)s | 10 """Name: %(name)s |
| 11 Version: %(version)s | 11 Version: %(version)s |
| 12 Repository: %(repository)s | 12 Repository: %(repository)s |
| 13 Tag: %(tag)s | 13 Tag: %(tag)s |
| 14 Revision: %(revision)s | 14 Revision: %(revision)s |
| 15 Tree link: %(tree)s | 15 Tree link: %(tree)s |
| 16 """ | 16 """ |
| 17 | 17 |
| 18 for entry in sorted(os.listdir(COMPONENTS_DIR)): | 18 for entry in sorted(os.listdir(COMPONENTS_DIR)): |
| 19 component_path = os.path.join(COMPONENTS_DIR, entry) | 19 component_path = os.path.join(COMPONENTS_DIR, entry) |
| 20 if not os.path.isdir(component_path): | 20 if not os.path.isdir(component_path): |
| 21 continue | 21 continue |
| 22 bower_path = os.path.join(component_path, '.bower.json') | 22 bower_path = os.path.join(component_path, '.bower.json') |
| 23 if not os.path.isfile(bower_path): | 23 if not os.path.isfile(bower_path): |
| 24 raise Exception('%s is not a file.' % bower_path) | 24 raise Exception('%s is not a file.' % bower_path) |
| 25 with open(bower_path) as stream: | 25 with open(bower_path) as stream: |
| 26 info = json.load(stream) | 26 info = json.load(stream) |
| 27 repository = info['_source'] | 27 repository = info['_source'] |
| 28 tree = 'https%s/tree/%s' % (repository[3:-4], info['_resolution']['tag']) | 28 tree = 'https%s/tree/%s' % (repository[3:-4], info['_resolution']['tag']) |
| 29 print COMPONENT_SUMMARY % { | 29 print COMPONENT_SUMMARY % { |
| 30 'name': info['name'], | 30 'name': info['name'], |
| 31 'version': info['version'], | 31 'version': info['version'], |
| 32 'repository': repository, | 32 'repository': repository, |
| 33 'tag': info['_resolution']['tag'], | 33 'tag': info['_resolution']['tag'], |
| 34 'revision': info['_resolution']['commit'], | 34 'revision': info['_resolution']['commit'], |
| 35 'tree': tree | 35 'tree': tree |
| 36 } | 36 } |
| OLD | NEW |