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 """A git command for managing a local cache of git repositories.""" | 6 """A git command for managing a local cache of git repositories.""" |
7 | 7 |
8 from __future__ import print_function | 8 from __future__ import print_function |
9 import errno | 9 import errno |
10 import logging | 10 import logging |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 python_fallback = False | 245 python_fallback = False |
246 if sys.platform.startswith('win') and not self.FindExecutable('7z'): | 246 if sys.platform.startswith('win') and not self.FindExecutable('7z'): |
247 python_fallback = True | 247 python_fallback = True |
248 elif sys.platform.startswith('darwin'): | 248 elif sys.platform.startswith('darwin'): |
249 # The OSX version of unzip doesn't support zip64. | 249 # The OSX version of unzip doesn't support zip64. |
250 python_fallback = True | 250 python_fallback = True |
251 elif not self.FindExecutable('unzip'): | 251 elif not self.FindExecutable('unzip'): |
252 python_fallback = True | 252 python_fallback = True |
253 | 253 |
254 gs_folder = 'gs://%s/%s' % (self.bootstrap_bucket, self.basedir) | 254 gs_folder = 'gs://%s/%s' % (self.bootstrap_bucket, self.basedir) |
255 gsutil = Gsutil( | 255 gsutil = Gsutil(self.gsutil_exe, bypass_prodaccess=True) |
256 self.gsutil_exe, boto_path=os.devnull, bypass_prodaccess=True) | |
257 # Get the most recent version of the zipfile. | 256 # Get the most recent version of the zipfile. |
258 _, ls_out, _ = gsutil.check_call('ls', gs_folder) | 257 _, ls_out, _ = gsutil.check_call('ls', gs_folder) |
259 ls_out_sorted = sorted(ls_out.splitlines()) | 258 ls_out_sorted = sorted(ls_out.splitlines()) |
260 if not ls_out_sorted: | 259 if not ls_out_sorted: |
261 # This repo is not on Google Storage. | 260 # This repo is not on Google Storage. |
262 return False | 261 return False |
263 latest_checkout = ls_out_sorted[-1] | 262 latest_checkout = ls_out_sorted[-1] |
264 | 263 |
265 # Download zip file to a temporary directory. | 264 # Download zip file to a temporary directory. |
266 try: | 265 try: |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 return options, args | 528 return options, args |
530 | 529 |
531 | 530 |
532 def main(argv): | 531 def main(argv): |
533 dispatcher = subcommand.CommandDispatcher(__name__) | 532 dispatcher = subcommand.CommandDispatcher(__name__) |
534 return dispatcher.execute(OptionParser(), argv) | 533 return dispatcher.execute(OptionParser(), argv) |
535 | 534 |
536 | 535 |
537 if __name__ == '__main__': | 536 if __name__ == '__main__': |
538 sys.exit(main(sys.argv[1:])) | 537 sys.exit(main(sys.argv[1:])) |
OLD | NEW |