| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Swarming Authors. All rights reserved. | 2 # Copyright 2013 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 """Archives a set of files or directories to an Isolate Server.""" | 6 """Archives a set of files or directories to an Isolate Server.""" |
| 7 | 7 |
| 8 __version__ = '0.4.3' | 8 __version__ = '0.4.3' |
| 9 | 9 |
| 10 import base64 | 10 import base64 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 import types | 21 import types |
| 22 import urllib | 22 import urllib |
| 23 import urlparse | 23 import urlparse |
| 24 import zlib | 24 import zlib |
| 25 | 25 |
| 26 from third_party import colorama | 26 from third_party import colorama |
| 27 from third_party.depot_tools import fix_encoding | 27 from third_party.depot_tools import fix_encoding |
| 28 from third_party.depot_tools import subcommand | 28 from third_party.depot_tools import subcommand |
| 29 | 29 |
| 30 from utils import file_path | 30 from utils import file_path |
| 31 from utils import logging_utils |
| 31 from utils import lru | 32 from utils import lru |
| 32 from utils import net | 33 from utils import net |
| 33 from utils import on_error | 34 from utils import on_error |
| 34 from utils import threading_utils | 35 from utils import threading_utils |
| 35 from utils import tools | 36 from utils import tools |
| 36 | 37 |
| 37 import auth | 38 import auth |
| 38 import isolated_format | 39 import isolated_format |
| 39 | 40 |
| 40 | 41 |
| (...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 | 2174 |
| 2174 # |options.cache| path may not exist until DiskCache() instance is created. | 2175 # |options.cache| path may not exist until DiskCache() instance is created. |
| 2175 return DiskCache( | 2176 return DiskCache( |
| 2176 unicode(os.path.abspath(options.cache)), | 2177 unicode(os.path.abspath(options.cache)), |
| 2177 policies, | 2178 policies, |
| 2178 isolated_format.get_hash_algo(options.namespace)) | 2179 isolated_format.get_hash_algo(options.namespace)) |
| 2179 else: | 2180 else: |
| 2180 return MemoryCache() | 2181 return MemoryCache() |
| 2181 | 2182 |
| 2182 | 2183 |
| 2183 class OptionParserIsolateServer(tools.OptionParserWithLogging): | 2184 class OptionParserIsolateServer(logging_utils.OptionParserWithLogging): |
| 2184 def __init__(self, **kwargs): | 2185 def __init__(self, **kwargs): |
| 2185 tools.OptionParserWithLogging.__init__( | 2186 logging_utils.OptionParserWithLogging.__init__( |
| 2186 self, | 2187 self, |
| 2187 version=__version__, | 2188 version=__version__, |
| 2188 prog=os.path.basename(sys.modules[__name__].__file__), | 2189 prog=os.path.basename(sys.modules[__name__].__file__), |
| 2189 **kwargs) | 2190 **kwargs) |
| 2190 auth.add_auth_options(self) | 2191 auth.add_auth_options(self) |
| 2191 | 2192 |
| 2192 def parse_args(self, *args, **kwargs): | 2193 def parse_args(self, *args, **kwargs): |
| 2193 options, args = tools.OptionParserWithLogging.parse_args( | 2194 options, args = logging_utils.OptionParserWithLogging.parse_args( |
| 2194 self, *args, **kwargs) | 2195 self, *args, **kwargs) |
| 2195 auth.process_auth_options(self, options) | 2196 auth.process_auth_options(self, options) |
| 2196 return options, args | 2197 return options, args |
| 2197 | 2198 |
| 2198 | 2199 |
| 2199 def main(args): | 2200 def main(args): |
| 2200 dispatcher = subcommand.CommandDispatcher(__name__) | 2201 dispatcher = subcommand.CommandDispatcher(__name__) |
| 2201 return dispatcher.execute(OptionParserIsolateServer(), args) | 2202 return dispatcher.execute(OptionParserIsolateServer(), args) |
| 2202 | 2203 |
| 2203 | 2204 |
| 2204 if __name__ == '__main__': | 2205 if __name__ == '__main__': |
| 2205 fix_encoding.fix_encoding() | 2206 fix_encoding.fix_encoding() |
| 2206 tools.disable_buffering() | 2207 tools.disable_buffering() |
| 2207 colorama.init() | 2208 colorama.init() |
| 2208 sys.exit(main(sys.argv[1:])) | 2209 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |