| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2012 The LUCI Authors. All rights reserved. | 2 # Copyright 2012 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed by the Apache v2.0 license that can be | 3 # Use of this source code is governed by the Apache v2.0 license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Front end tool to operate on .isolate files. | 6 """Front end tool to operate on .isolate files. |
| 7 | 7 |
| 8 This includes creating, merging or compiling them to generate a .isolated file. | 8 This includes creating, merging or compiling them to generate a .isolated file. |
| 9 | 9 |
| 10 See more information at | 10 See more information at |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 """ | 848 """ |
| 849 add_isolate_options(parser) | 849 add_isolate_options(parser) |
| 850 add_subdir_option(parser) | 850 add_subdir_option(parser) |
| 851 isolateserver.add_isolate_server_options(parser) | 851 isolateserver.add_isolate_server_options(parser) |
| 852 auth.add_auth_options(parser) | 852 auth.add_auth_options(parser) |
| 853 options, args = parser.parse_args(args) | 853 options, args = parser.parse_args(args) |
| 854 if args: | 854 if args: |
| 855 parser.error('Unsupported argument: %s' % args) | 855 parser.error('Unsupported argument: %s' % args) |
| 856 process_isolate_options(parser, options) | 856 process_isolate_options(parser, options) |
| 857 auth.process_auth_options(parser, options) | 857 auth.process_auth_options(parser, options) |
| 858 isolateserver.process_isolate_server_options(parser, options, True) | 858 isolateserver.process_isolate_server_options(parser, options, True, True) |
| 859 result = isolate_and_archive( | 859 result = isolate_and_archive( |
| 860 [(options, unicode(os.getcwd()))], | 860 [(options, unicode(os.getcwd()))], |
| 861 options.isolate_server, | 861 options.isolate_server, |
| 862 options.namespace) | 862 options.namespace) |
| 863 if result is None: | 863 if result is None: |
| 864 return EXIT_CODE_UPLOAD_ERROR | 864 return EXIT_CODE_UPLOAD_ERROR |
| 865 assert len(result) == 1, result | 865 assert len(result) == 1, result |
| 866 if result.values()[0] is None: | 866 if result.values()[0] is None: |
| 867 return EXIT_CODE_ISOLATE_ERROR | 867 return EXIT_CODE_ISOLATE_ERROR |
| 868 return 0 | 868 return 0 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 887 """ | 887 """ |
| 888 isolateserver.add_isolate_server_options(parser) | 888 isolateserver.add_isolate_server_options(parser) |
| 889 isolateserver.add_archive_options(parser) | 889 isolateserver.add_archive_options(parser) |
| 890 auth.add_auth_options(parser) | 890 auth.add_auth_options(parser) |
| 891 parser.add_option( | 891 parser.add_option( |
| 892 '--dump-json', | 892 '--dump-json', |
| 893 metavar='FILE', | 893 metavar='FILE', |
| 894 help='Write isolated hashes of archived trees to this file as JSON') | 894 help='Write isolated hashes of archived trees to this file as JSON') |
| 895 options, args = parser.parse_args(args) | 895 options, args = parser.parse_args(args) |
| 896 auth.process_auth_options(parser, options) | 896 auth.process_auth_options(parser, options) |
| 897 isolateserver.process_isolate_server_options(parser, options, True) | 897 isolateserver.process_isolate_server_options(parser, options, True, True) |
| 898 | 898 |
| 899 # Validate all incoming options, prepare what needs to be archived as a list | 899 # Validate all incoming options, prepare what needs to be archived as a list |
| 900 # of tuples (archival options, working directory). | 900 # of tuples (archival options, working directory). |
| 901 work_units = [] | 901 work_units = [] |
| 902 for gen_json_path in args: | 902 for gen_json_path in args: |
| 903 # Validate JSON format of a *.isolated.gen.json file. | 903 # Validate JSON format of a *.isolated.gen.json file. |
| 904 try: | 904 try: |
| 905 data = tools.read_json(gen_json_path) | 905 data = tools.read_json(gen_json_path) |
| 906 except IOError as e: | 906 except IOError as e: |
| 907 parser.error('Failed to open %s: %s' % (gen_json_path, e)) | 907 parser.error('Failed to open %s: %s' % (gen_json_path, e)) |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 except ExecutionError as e: | 1215 except ExecutionError as e: |
| 1216 print >> sys.stderr, 'Execution failure: %s' % e | 1216 print >> sys.stderr, 'Execution failure: %s' % e |
| 1217 return 1 | 1217 return 1 |
| 1218 | 1218 |
| 1219 | 1219 |
| 1220 if __name__ == '__main__': | 1220 if __name__ == '__main__': |
| 1221 fix_encoding.fix_encoding() | 1221 fix_encoding.fix_encoding() |
| 1222 tools.disable_buffering() | 1222 tools.disable_buffering() |
| 1223 colorama.init() | 1223 colorama.init() |
| 1224 sys.exit(main(sys.argv[1:])) | 1224 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |