| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 |
| 6 import argparse |
| 5 import StringIO | 7 import StringIO |
| 6 import sys | 8 import sys |
| 7 import os | 9 import os |
| 8 import optparse | |
| 9 | 10 |
| 10 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 11 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 11 sys.path.append(os.path.join(os.path.dirname(SCRIPT_DIR), 'tools')) | 12 sys.path.append(os.path.join(os.path.dirname(SCRIPT_DIR), 'tools')) |
| 12 | 13 |
| 13 import getos | 14 import getos |
| 14 | 15 |
| 15 valid_tools = ['newlib', 'glibc', getos.GetPlatform()] | 16 valid_tools = ['newlib', 'glibc', getos.GetPlatform()] |
| 16 | 17 |
| 17 | 18 |
| 18 def Error(msg): | 19 def Error(msg): |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 else: | 353 else: |
| 353 output.write(HOST_LIB_TARGET % target) | 354 output.write(HOST_LIB_TARGET % target) |
| 354 | 355 |
| 355 output.write(' ],\n}\n') | 356 output.write(' ],\n}\n') |
| 356 | 357 |
| 357 print('Writing: ' + outfile) | 358 print('Writing: ' + outfile) |
| 358 open(outfile, 'w').write(output.getvalue()) | 359 open(outfile, 'w').write(output.getvalue()) |
| 359 | 360 |
| 360 | 361 |
| 361 def main(args): | 362 def main(args): |
| 362 parser = optparse.OptionParser() | 363 parser = argparse.ArgumentParser() |
| 363 parser.add_option('-o', help='Set output filename.', dest='output') | 364 parser.add_argument('-o', help='Set output filename.', dest='output') |
| 364 options, args = parser.parse_args(args) | 365 parser.add_argument('dsc', help='dsc to convert') |
| 365 if not args: | 366 options = parser.parse_args(args) |
| 366 Error('No .dsc file specified.') | |
| 367 | 367 |
| 368 if options.output: | 368 if options.output: |
| 369 outdir = os.path.dirname(options.output) | 369 outdir = os.path.dirname(options.output) |
| 370 if not os.path.exists(outdir): | 370 if not os.path.exists(outdir): |
| 371 os.makedirs(outdir) | 371 os.makedirs(outdir) |
| 372 | 372 |
| 373 assert len(args) == 1 | 373 ProcessDSC(options.dsc, options.output) |
| 374 ProcessDSC(args[0], options.output) | |
| 375 return 0 | 374 return 0 |
| 376 | 375 |
| 377 | 376 |
| 378 if __name__ == '__main__': | 377 if __name__ == '__main__': |
| 379 sys.exit(main(sys.argv[1:])) | 378 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |