| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 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 """Simple tool to generate NMF file by just reformatting given arguments. | 6 """Simple tool to generate NMF file by just reformatting given arguments. |
| 7 | 7 |
| 8 This tool is similar to native_client_sdk/src/tools/create_nmf.py. | 8 This tool is similar to native_client_sdk/src/tools/create_nmf.py. |
| 9 create_nmf.py handles most cases, with the exception of Non-SFI nexes. | 9 create_nmf.py handles most cases, with the exception of Non-SFI nexes. |
| 10 create_nmf.py tries to auto-detect nexe and pexe types based on their contents, | 10 create_nmf.py tries to auto-detect nexe and pexe types based on their contents, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 _FILES_KEY = 'files' | 24 _FILES_KEY = 'files' |
| 25 _PORTABLE_KEY = 'portable' | 25 _PORTABLE_KEY = 'portable' |
| 26 _PROGRAM_KEY = 'program' | 26 _PROGRAM_KEY = 'program' |
| 27 _URL_KEY = 'url' | 27 _URL_KEY = 'url' |
| 28 | 28 |
| 29 def ParseArgs(): | 29 def ParseArgs(): |
| 30 parser = argparse.ArgumentParser() | 30 parser = argparse.ArgumentParser() |
| 31 parser.add_argument( | 31 parser.add_argument( |
| 32 '--program', metavar='FILE', help='Main program nexe') | 32 '--program', metavar='FILE', help='Main program nexe') |
| 33 parser.add_argument( | 33 parser.add_argument( |
| 34 '--arch', metavar='ARCH', choices=('x86-32', 'arm'), | 34 '--arch', metavar='ARCH', choices=('x86-32', 'x86-64', 'arm'), |
| 35 help='The archtecture of main program nexe') | 35 help='The archtecture of main program nexe') |
| 36 # To keep compatibility with create_nmf.py, we use -x and --extra-files | 36 # To keep compatibility with create_nmf.py, we use -x and --extra-files |
| 37 # as flags. | 37 # as flags. |
| 38 parser.add_argument( | 38 parser.add_argument( |
| 39 '-x', '--extra-files', action='append', metavar='KEY:FILE', default=[], | 39 '-x', '--extra-files', action='append', metavar='KEY:FILE', default=[], |
| 40 help=('Add extra key:file tuple to the "files" ' | 40 help=('Add extra key:file tuple to the "files" ' |
| 41 'section of the .nmf')) | 41 'section of the .nmf')) |
| 42 parser.add_argument( | 42 parser.add_argument( |
| 43 '--output', metavar='FILE', help='Path to the output nmf file.') | 43 '--output', metavar='FILE', help='Path to the output nmf file.') |
| 44 | 44 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 logging.error('--output is not specified.') | 91 logging.error('--output is not specified.') |
| 92 sys.exit(1) | 92 sys.exit(1) |
| 93 | 93 |
| 94 nmf_map = BuildNmfMap(os.path.dirname(args.output), | 94 nmf_map = BuildNmfMap(os.path.dirname(args.output), |
| 95 args.program, args.arch, args.extra_files) | 95 args.program, args.arch, args.extra_files) |
| 96 OutputNmf(nmf_map, args.output) | 96 OutputNmf(nmf_map, args.output) |
| 97 | 97 |
| 98 | 98 |
| 99 if __name__ == '__main__': | 99 if __name__ == '__main__': |
| 100 main() | 100 main() |
| OLD | NEW |