OLD | NEW |
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 """Uploads files to Google Storage content addressed.""" | 6 """Uploads files to Google Storage content addressed.""" |
7 | 7 |
8 import hashlib | 8 import hashlib |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 bypass_prodaccess=True) | 238 bypass_prodaccess=True) |
239 else: | 239 else: |
240 gsutil = None | 240 gsutil = None |
241 for path in os.environ["PATH"].split(os.pathsep): | 241 for path in os.environ["PATH"].split(os.pathsep): |
242 if os.path.exists(path) and 'gsutil' in os.listdir(path): | 242 if os.path.exists(path) and 'gsutil' in os.listdir(path): |
243 gsutil = Gsutil(os.path.join(path, 'gsutil'), boto_path=options.boto) | 243 gsutil = Gsutil(os.path.join(path, 'gsutil'), boto_path=options.boto) |
244 if not gsutil: | 244 if not gsutil: |
245 parser.error('gsutil not found in %s, bad depot_tools checkout?' % | 245 parser.error('gsutil not found in %s, bad depot_tools checkout?' % |
246 GSUTIL_DEFAULT_PATH) | 246 GSUTIL_DEFAULT_PATH) |
247 | 247 |
| 248 base_url = 'gs://%s' % options.bucket |
| 249 |
248 # Check we have a valid bucket with valid permissions. | 250 # Check we have a valid bucket with valid permissions. |
249 base_url, code = check_bucket_permissions(options.bucket, gsutil) | 251 code = check_bucket_permissions(base_url, gsutil) |
250 if code: | 252 if code: |
251 return code | 253 return code |
252 | 254 |
253 return upload_to_google_storage( | 255 return upload_to_google_storage( |
254 input_filenames, base_url, gsutil, options.force, options.use_md5, | 256 input_filenames, base_url, gsutil, options.force, options.use_md5, |
255 options.num_threads, options.skip_hashing) | 257 options.num_threads, options.skip_hashing) |
256 | 258 |
257 | 259 |
258 if __name__ == '__main__': | 260 if __name__ == '__main__': |
259 sys.exit(main(sys.argv)) | 261 sys.exit(main(sys.argv)) |
OLD | NEW |