Chromium Code Reviews| Index: third_party/polymer/v1_0/create_components_summary.py |
| diff --git a/third_party/polymer/v1_0/create_components_summary.py b/third_party/polymer/v1_0/create_components_summary.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..84082c7014cea9fbd99aa3f50d4362207f8883e6 |
| --- /dev/null |
| +++ b/third_party/polymer/v1_0/create_components_summary.py |
| @@ -0,0 +1,35 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import os |
| +import json |
| + |
| +COMPONENTS_DIR = 'components-chromium' |
| +COMPONENT_SUMMARY =\ |
| +"""Name: %(name)s |
| +Version: %(version)s |
| +Repository: %(repository)s |
| +Tag: %(tag)s |
| +Revision: %(revision)s |
| +Tree link: %(tree)s |
| +""" |
| + |
| +for entry in sorted(os.listdir(COMPONENTS_DIR)): |
| + component_path = os.path.join(COMPONENTS_DIR, entry) |
| + if not os.path.isdir(component_path): |
| + continue |
| + bower_path = os.path.join(component_path, '.bower.json') |
| + 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.
|
| + raise Exception('%s doesn\'t exist.' % bower_path) |
| + 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.
|
| + repository = info['_source'] |
| + 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.
|
| + print COMPONENT_SUMMARY % { |
| + 'name': info['name'], |
| + 'version': info['version'], |
| + 'repository': repository, |
| + 'tag': info['_resolution']['tag'], |
| + 'revision': info['_resolution']['commit'], |
| + 'tree': tree |
| + } |