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 """Chromium presubmit script for src/extensions/common. | |
| 6 | |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | |
| 8 for more details on the presubmit API built into depot_tools. | |
| 9 """ | |
| 10 | |
| 11 import sys | |
| 12 | |
| 13 | |
| 14 def _CheckExterns(input_api, output_api): | |
| 15 original_sys_path = sys.path | |
| 16 | |
|
Dan Beam
2016/03/03 00:24:20
join = input_api.os_path.join
api_root = input_api
Devlin
2016/03/07 19:49:29
I like it. Done.
| |
| 17 try: | |
| 18 sys.path.append( | |
| 19 input_api.os_path.join( | |
| 20 input_api.PresubmitLocalPath(), '..', '..', '..', '..', | |
| 21 'extensions', 'common', 'api')) | |
| 22 from externs_checker import ExternsChecker | |
| 23 finally: | |
| 24 sys.path = original_sys_path | |
| 25 | |
| 26 api_root = input_api.PresubmitLocalPath() | |
| 27 join = input_api.os_path.join | |
| 28 externs_root = join(api_root, '..', '..', '..', '..', 'third_party', | |
| 29 'closure_compiler', 'externs') | |
| 30 | |
| 31 api_pair_names = { | |
| 32 'autofill_private.idl': 'autofill_private.js', | |
| 33 'developer_private.idl': 'developer_private.js', | |
| 34 'bookmark_manager_private.json': 'bookmark_manager_private.js', | |
| 35 'command_line_private.json': 'command_line_private.js', | |
| 36 'file_manager_private.idl': 'file_manager_private.js', | |
| 37 'language_settings_private.idl': 'language_settings_private.js', | |
| 38 'metrics_private.json': 'metrics_private.js', | |
| 39 'passwords_private.idl': 'passwords_private.js', | |
| 40 'system_private.json': 'system_private.js', | |
| 41 'users_private.idl': 'users_private.js', | |
| 42 # TODO(rdevlin.cronin): Add more! | |
| 43 } | |
| 44 normpath = input_api.os_path.normpath | |
| 45 api_pairs = { | |
| 46 normpath(join(api_root, k)): | |
| 47 normpath(join(externs_root, v)) for k, v in api_pair_names.items() | |
|
Dan Beam
2016/03/03 00:24:20
mind == blown
Devlin
2016/03/07 19:49:29
Yay for python!
| |
| 48 } | |
| 49 | |
| 50 return ExternsChecker(input_api, output_api, api_pairs).RunChecks() | |
| 51 | |
| 52 | |
| 53 def CheckChangeOnUpload(input_api, output_api): | |
| 54 return _CheckExterns(input_api, output_api) | |
| OLD | NEW |