OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2012 The Swarming Authors. All rights reserved. | 2 # Copyright 2012 The Swarming Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 that | 3 # Use of this source code is governed under the Apache License, Version 2.0 that |
4 # can be found in the LICENSE file. | 4 # can be 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 16 matching lines...) Expand all Loading... |
27 import auth | 27 import auth |
28 import isolate_format | 28 import isolate_format |
29 import isolated_format | 29 import isolated_format |
30 import isolateserver | 30 import isolateserver |
31 import run_isolated | 31 import run_isolated |
32 | 32 |
33 from third_party import colorama | 33 from third_party import colorama |
34 from third_party.depot_tools import fix_encoding | 34 from third_party.depot_tools import fix_encoding |
35 from third_party.depot_tools import subcommand | 35 from third_party.depot_tools import subcommand |
36 | 36 |
| 37 from utils import logging_utils |
37 from utils import file_path | 38 from utils import file_path |
38 from utils import tools | 39 from utils import tools |
39 | 40 |
40 | 41 |
41 # Exit code of 'archive' and 'batcharchive' if the command fails due to an error | 42 # Exit code of 'archive' and 'batcharchive' if the command fails due to an error |
42 # in *.isolate file (format error, or some referenced files are missing, etc.) | 43 # in *.isolate file (format error, or some referenced files are missing, etc.) |
43 EXIT_CODE_ISOLATE_ERROR = 1 | 44 EXIT_CODE_ISOLATE_ERROR = 1 |
44 | 45 |
45 | 46 |
46 # Exit code of 'archive' and 'batcharchive' if the command fails due to | 47 # Exit code of 'archive' and 'batcharchive' if the command fails due to |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 if options.isolate: | 1194 if options.isolate: |
1194 # TODO(maruel): Work with non-ASCII. | 1195 # TODO(maruel): Work with non-ASCII. |
1195 # The path must be in native path case for tracing purposes. | 1196 # The path must be in native path case for tracing purposes. |
1196 options.isolate = unicode(options.isolate).replace('/', os.path.sep) | 1197 options.isolate = unicode(options.isolate).replace('/', os.path.sep) |
1197 options.isolate = os.path.normpath(os.path.join(cwd, options.isolate)) | 1198 options.isolate = os.path.normpath(os.path.join(cwd, options.isolate)) |
1198 options.isolate = file_path.get_native_path_case(options.isolate) | 1199 options.isolate = file_path.get_native_path_case(options.isolate) |
1199 | 1200 |
1200 | 1201 |
1201 def main(argv): | 1202 def main(argv): |
1202 dispatcher = subcommand.CommandDispatcher(__name__) | 1203 dispatcher = subcommand.CommandDispatcher(__name__) |
1203 parser = tools.OptionParserWithLogging( | 1204 parser = logging_utils.OptionParserWithLogging( |
1204 version=__version__, verbose=int(os.environ.get('ISOLATE_DEBUG', 0))) | 1205 version=__version__, verbose=int(os.environ.get('ISOLATE_DEBUG', 0))) |
1205 try: | 1206 try: |
1206 return dispatcher.execute(parser, argv) | 1207 return dispatcher.execute(parser, argv) |
1207 except isolated_format.MappingError as e: | 1208 except isolated_format.MappingError as e: |
1208 print >> sys.stderr, 'Failed to find an input file: %s' % e | 1209 print >> sys.stderr, 'Failed to find an input file: %s' % e |
1209 return 1 | 1210 return 1 |
1210 except ExecutionError as e: | 1211 except ExecutionError as e: |
1211 print >> sys.stderr, 'Execution failure: %s' % e | 1212 print >> sys.stderr, 'Execution failure: %s' % e |
1212 return 1 | 1213 return 1 |
1213 | 1214 |
1214 | 1215 |
1215 if __name__ == '__main__': | 1216 if __name__ == '__main__': |
1216 fix_encoding.fix_encoding() | 1217 fix_encoding.fix_encoding() |
1217 tools.disable_buffering() | 1218 tools.disable_buffering() |
1218 colorama.init() | 1219 colorama.init() |
1219 sys.exit(main(sys.argv[1:])) | 1220 sys.exit(main(sys.argv[1:])) |
OLD | NEW |