OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """Prints the size of each given file and optionally computes the size of | 6 """Prints the size of each given file and optionally computes the size of |
7 libchrome.so without the dependencies added for building with android NDK. | 7 libchrome.so without the dependencies added for building with android NDK. |
8 Also breaks down the contents of the APK to determine the installed size | 8 Also breaks down the contents of the APK to determine the installed size |
9 and assign size contributions to different classes of file. | 9 and assign size contributions to different classes of file. |
10 """ | 10 """ |
(...skipping 11 matching lines...) Expand all Loading... |
22 import zipfile | 22 import zipfile |
23 import zlib | 23 import zlib |
24 | 24 |
25 import devil_chromium | 25 import devil_chromium |
26 from devil.utils import cmd_helper | 26 from devil.utils import cmd_helper |
27 from pylib import constants | 27 from pylib import constants |
28 from pylib.constants import host_paths | 28 from pylib.constants import host_paths |
29 | 29 |
30 _GRIT_PATH = os.path.join(host_paths.DIR_SOURCE_ROOT, 'tools', 'grit') | 30 _GRIT_PATH = os.path.join(host_paths.DIR_SOURCE_ROOT, 'tools', 'grit') |
31 | 31 |
32 with host_paths.SysPath(_GRIT_PATH): | 32 # Prepend the grit module from the source tree so it takes precedence over other |
| 33 # grit versions that might present in the search path. |
| 34 with host_paths.SysPath(_GRIT_PATH, 1): |
33 from grit.format import data_pack # pylint: disable=import-error | 35 from grit.format import data_pack # pylint: disable=import-error |
34 | 36 |
35 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): | 37 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): |
36 import perf_tests_results_helper # pylint: disable=import-error | 38 import perf_tests_results_helper # pylint: disable=import-error |
37 | 39 |
38 # Python had a bug in zipinfo parsing that triggers on ChromeModern.apk | 40 # Python had a bug in zipinfo parsing that triggers on ChromeModern.apk |
39 # https://bugs.python.org/issue14315 | 41 # https://bugs.python.org/issue14315 |
40 def _PatchedDecodeExtra(self): | 42 def _PatchedDecodeExtra(self): |
41 # Try to decode the extra field. | 43 # Try to decode the extra field. |
42 extra = self.extra | 44 extra = self.extra |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 456 |
455 if chartjson: | 457 if chartjson: |
456 results_path = os.path.join(options.output_dir, 'results-chart.json') | 458 results_path = os.path.join(options.output_dir, 'results-chart.json') |
457 logging.critical('Dumping json to %s', results_path) | 459 logging.critical('Dumping json to %s', results_path) |
458 with open(results_path, 'w') as json_file: | 460 with open(results_path, 'w') as json_file: |
459 json.dump(chartjson, json_file) | 461 json.dump(chartjson, json_file) |
460 | 462 |
461 | 463 |
462 if __name__ == '__main__': | 464 if __name__ == '__main__': |
463 sys.exit(main(sys.argv)) | 465 sys.exit(main(sys.argv)) |
OLD | NEW |