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