Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import inspect | |
| 6 import json | 7 import json |
| 7 import os | 8 import os |
| 8 import sys | 9 import sys |
| 9 | 10 |
| 10 SDK_EXTRAS_JSON_FILE = os.path.join(os.path.dirname(sys.argv[0]), | 11 FILENAME = inspect.getframeinfo(inspect.currentframe()).filename |
|
Nico
2015/01/30 17:29:37
The usual way we do this is
THIS_DIR = os.path.a
pauljensen
2015/01/30 17:31:41
__file__ is not defined when this is invoked in wa
| |
| 12 SDK_EXTRAS_JSON_FILE = os.path.join(os.path.dirname(FILENAME), | |
| 11 'android_sdk_extras.json') | 13 'android_sdk_extras.json') |
| 12 | 14 |
| 13 def main(): | 15 def main(): |
| 14 with open(SDK_EXTRAS_JSON_FILE) as json_file: | 16 with open(SDK_EXTRAS_JSON_FILE) as json_file: |
| 15 packages = json.load(json_file) | 17 packages = json.load(json_file) |
| 16 for package in packages: | 18 for package in packages: |
| 17 print package['package'].replace('_', ' ') | 19 print package['package'].replace('_', ' ') |
| 18 | 20 |
| 19 | 21 |
| 20 if __name__ == '__main__': | 22 if __name__ == '__main__': |
| 21 sys.exit(main()) | 23 sys.exit(main()) |
| OLD | NEW |