| 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 """Upload a single file to a Google Storage Bucket. | 6 """Upload a single file to a Google Storage Bucket. |
| 7 | 7 |
| 8 To test: | 8 To test: |
| 9 cd .../buildbot/slave/skia_slave_scripts/utils | 9 cd .../buildbot/slave/skia_slave_scripts/utils |
| 10 CR_BUILDBOT_PATH=../../../third_party/chromium_buildbot | 10 CR_BUILDBOT_PATH=../../../third_party/chromium_buildbot |
| 11 PYTHONPATH=$CR_BUILDBOT_PATH/scripts:$CR_BUILDBOT_PATH/site_config \ | 11 PYTHONPATH=$CR_BUILDBOT_PATH/scripts:$CR_BUILDBOT_PATH/site_config \ |
| 12 python upload_to_bucket.py \ | 12 python upload_to_bucket.py \ |
| 13 --source_filepath=../../../DEPS --dest_gsbase=gs://chromium-skia-gm | 13 --source_filepath=../../../DEPS --dest_gsbase=gs://chromium-skia-gm |
| 14 """ | 14 """ |
| 15 | 15 |
| 16 from utils import misc | 16 from py.utils import misc |
| 17 import optparse | 17 import optparse |
| 18 import os | 18 import os |
| 19 import sys | 19 import sys |
| 20 | 20 |
| 21 from slave import slave_utils | 21 from slave import slave_utils |
| 22 | 22 |
| 23 def upload_to_bucket(source_filepath, dest_gsbase, subdir=None): | 23 def upload_to_bucket(source_filepath, dest_gsbase, subdir=None): |
| 24 abs_source_filepath = misc.GetAbsPath(source_filepath) | 24 abs_source_filepath = misc.GetAbsPath(source_filepath) |
| 25 print 'translated source_filepath %s to absolute path %s' % ( | 25 print 'translated source_filepath %s to absolute path %s' % ( |
| 26 source_filepath, abs_source_filepath) | 26 source_filepath, abs_source_filepath) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 48 help='optional subdirectory within the bucket', | 48 help='optional subdirectory within the bucket', |
| 49 default=None) | 49 default=None) |
| 50 (options, _args) = option_parser.parse_args() | 50 (options, _args) = option_parser.parse_args() |
| 51 return upload_to_bucket(source_filepath=options.source_filepath, | 51 return upload_to_bucket(source_filepath=options.source_filepath, |
| 52 dest_gsbase=options.dest_gsbase, | 52 dest_gsbase=options.dest_gsbase, |
| 53 subdir=options.subdir) | 53 subdir=options.subdir) |
| 54 | 54 |
| 55 | 55 |
| 56 if '__main__' == __name__: | 56 if '__main__' == __name__: |
| 57 sys.exit(main(None)) | 57 sys.exit(main(None)) |
| OLD | NEW |