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

Side by Side Diff: native_client_sdk/src/tools/create_nmf.py

Issue 16022005: [NaCl SDK] Add keyboard interrupt handlers for python scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « native_client_sdk/src/build_tools/test_sdk.py ('k') | native_client_sdk/src/tools/oshelpers.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 import errno 6 import errno
7 import hashlib 7 import hashlib
8 import json 8 import json
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 Trace.verbose = True 628 Trace.verbose = True
629 if options.debug_mode: 629 if options.debug_mode:
630 DebugPrint.debug_mode = True 630 DebugPrint.debug_mode = True
631 631
632 if options.toolchain is not None: 632 if options.toolchain is not None:
633 print 'warning: option -t/--toolchain is deprecated.' 633 print 'warning: option -t/--toolchain is deprecated.'
634 634
635 if len(args) < 1: 635 if len(args) < 1:
636 raise Error('No nexe files specified. See --help for more info') 636 raise Error('No nexe files specified. See --help for more info')
637 637
638 for filename in args:
639 if not os.path.exists(filename):
640 raise Error('Input file not found: %s' % filename)
641 if not os.path.isfile(filename):
642 raise Error('Input is not a file: %s' % filename)
643
638 canonicalized = ParseExtraFiles(options.extra_files, sys.stderr) 644 canonicalized = ParseExtraFiles(options.extra_files, sys.stderr)
639 if canonicalized is None: 645 if canonicalized is None:
640 parser.error('Bad --extra-files (-x) argument syntax') 646 parser.error('Bad --extra-files (-x) argument syntax')
641 647
642 remap = {} 648 remap = {}
643 for ren in options.name: 649 for ren in options.name:
644 parts = ren.split(',') 650 parts = ren.split(',')
645 if len(parts) != 2: 651 if len(parts) != 2:
646 raise Error('Expecting --name=<orig_arch.so>,<new_name.so>') 652 raise Error('Expecting --name=<orig_arch.so>,<new_name.so>')
647 remap[parts[0]] = parts[1] 653 remap[parts[0]] = parts[1]
(...skipping 29 matching lines...) Expand all
677 return 0 683 return 0
678 684
679 685
680 # Invoke this file directly for simple testing. 686 # Invoke this file directly for simple testing.
681 if __name__ == '__main__': 687 if __name__ == '__main__':
682 try: 688 try:
683 rtn = main(sys.argv[1:]) 689 rtn = main(sys.argv[1:])
684 except Error, e: 690 except Error, e:
685 sys.stderr.write('%s: %s\n' % (os.path.basename(__file__), e)) 691 sys.stderr.write('%s: %s\n' % (os.path.basename(__file__), e))
686 rtn = 1 692 rtn = 1
693 except KeyboardInterrupt:
694 sys.stderr.write('%s: interrupted\n' % os.path.basename(__file__))
695 rtn = 1
687 sys.exit(rtn) 696 sys.exit(rtn)
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/test_sdk.py ('k') | native_client_sdk/src/tools/oshelpers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698