Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: tools/binary_size/libsupersize/console.py

Issue 2866103003: supersize: Fix --tool-prefix autodetection (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/binary_size/libsupersize/archive.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """An interactive console for looking analyzing .size files.""" 5 """An interactive console for looking analyzing .size files."""
6 6
7 import argparse 7 import argparse
8 import atexit 8 import atexit
9 import code 9 import code
10 import contextlib 10 import contextlib
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 def AddArguments(parser): 253 def AddArguments(parser):
254 parser.add_argument( 254 parser.add_argument(
255 'inputs', nargs='+', 255 'inputs', nargs='+',
256 help='Input .size files to load. For a single file, it will be mapped to ' 256 help='Input .size files to load. For a single file, it will be mapped to '
257 'the variable "size_info". For multiple inputs, the names will be ' 257 'the variable "size_info". For multiple inputs, the names will be '
258 'size_info1, size_info2, etc.') 258 'size_info1, size_info2, etc.')
259 parser.add_argument('--query', 259 parser.add_argument('--query',
260 help='Execute the given snippet. ' 260 help='Execute the given snippet. '
261 'Example: Print(size_info)') 261 'Example: Print(size_info)')
262 parser.add_argument('--tool-prefix', default='', 262 parser.add_argument('--tool-prefix',
263 help='Path prefix for objdump. Required only for ' 263 help='Path prefix for objdump. Required only for '
264 'Disassemble().') 264 'Disassemble().')
265 parser.add_argument('--output-directory', 265 parser.add_argument('--output-directory',
266 help='Path to the root build directory. Used only for ' 266 help='Path to the root build directory. Used only for '
267 'Disassemble().') 267 'Disassemble().')
268 268
269 269
270 def Run(args, parser): 270 def Run(args, parser):
271 for path in args.inputs: 271 for path in args.inputs:
272 if not path.endswith('.size'): 272 if not path.endswith('.size'):
273 parser.error('All inputs must end with ".size"') 273 parser.error('All inputs must end with ".size"')
274 274
275 size_infos = [archive.LoadAndPostProcessSizeInfo(p) for p in args.inputs] 275 size_infos = [archive.LoadAndPostProcessSizeInfo(p) for p in args.inputs]
276 lazy_paths = paths.LazyPaths(tool_prefix=args.tool_prefix, 276 lazy_paths = paths.LazyPaths(tool_prefix=args.tool_prefix,
277 output_directory=args.output_directory, 277 output_directory=args.output_directory,
278 any_path_within_output_directory=args.inputs[0]) 278 any_path_within_output_directory=args.inputs[0])
279 session = _Session(size_infos, lazy_paths) 279 session = _Session(size_infos, lazy_paths)
280 280
281 if args.query: 281 if args.query:
282 logging.info('Running query from command-line.') 282 logging.info('Running query from command-line.')
283 session.Eval(args.query) 283 session.Eval(args.query)
284 else: 284 else:
285 logging.info('Entering interactive console.') 285 logging.info('Entering interactive console.')
286 session.GoInteractive() 286 session.GoInteractive()
OLDNEW
« no previous file with comments | « tools/binary_size/libsupersize/archive.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698