Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import os | |
| 6 import json | |
| 7 | |
| 8 COMPONENTS_DIR = 'components-chromium' | |
| 9 COMPONENT_SUMMARY =\ | |
| 10 """Name: %(name)s | |
| 11 Version: %(version)s | |
| 12 Repository: %(repository)s | |
| 13 Tag: %(tag)s | |
| 14 Revision: %(revision)s | |
| 15 Tree link: %(tree)s | |
| 16 """ | |
| 17 | |
| 18 for entry in sorted(os.listdir(COMPONENTS_DIR)): | |
| 19 component_path = os.path.join(COMPONENTS_DIR, entry) | |
| 20 if not os.path.isdir(component_path): | |
| 21 continue | |
| 22 bower_path = os.path.join(component_path, '.bower.json') | |
| 23 if not os.path.exists(bower_path): | |
|
michaelpg
2016/01/23 04:28:15
isfile
dzhioev (left Google)
2016/01/25 23:31:35
Done.
| |
| 24 raise Exception('%s doesn\'t exist.' % bower_path) | |
| 25 info = json.load(open(bower_path)) | |
|
michaelpg
2016/01/23 04:28:15
nit: with open(...
dzhioev (left Google)
2016/01/25 23:31:35
Done.
| |
| 26 repository = info['_source'] | |
| 27 tree = 'https%s/tree/%s' % (repository[3:][:-4], info['_resolution']['tag']) | |
|
michaelpg
2016/01/23 04:28:15
[3:-4]
dzhioev (left Google)
2016/01/25 23:31:35
Done.
| |
| 28 print COMPONENT_SUMMARY % { | |
| 29 'name': info['name'], | |
| 30 'version': info['version'], | |
| 31 'repository': repository, | |
| 32 'tag': info['_resolution']['tag'], | |
| 33 'revision': info['_resolution']['commit'], | |
| 34 'tree': tree | |
| 35 } | |
| OLD | NEW |