OLD | NEW |
---|---|
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import re | 5 import re |
6 | 6 |
7 from recipe_engine import recipe_api | 7 from recipe_engine import recipe_api |
8 | 8 |
9 class GSUtilApi(recipe_api.RecipeApi): | 9 class GSUtilApi(recipe_api.RecipeApi): |
10 def __call__(self, cmd, name=None, use_retry_wrapper=True, version=None, | 10 def __call__(self, cmd, name=None, use_retry_wrapper=True, version=None, |
(...skipping 10 matching lines...) Expand all Loading... | |
21 Arguments: | 21 Arguments: |
22 cmd: list of (string) arguments to pass to gsutil. | 22 cmd: list of (string) arguments to pass to gsutil. |
23 Include gsutil-level options first (see 'gsutil help options'). | 23 Include gsutil-level options first (see 'gsutil help options'). |
24 name: the (string) name of the step to use. | 24 name: the (string) name of the step to use. |
25 Defaults to the first non-flag token in the cmd. | 25 Defaults to the first non-flag token in the cmd. |
26 """ | 26 """ |
27 if not name: | 27 if not name: |
28 name = (t for t in cmd if not t.startswith('-')).next() | 28 name = (t for t in cmd if not t.startswith('-')).next() |
29 full_name = 'gsutil ' + name | 29 full_name = 'gsutil ' + name |
30 | 30 |
31 gsutil_path = self.m.path['depot_tools'].join('gsutil.py') | 31 gsutil_path = self.m.depot_tools.gsutil_py_path |
tandrii(chromium)
2016/06/03 13:28:17
why not move this whole recipe into depot_tools? S
tandrii(chromium)
2016/06/03 13:48:58
discussed in IM: we postpone the actual refactorin
| |
32 cmd_prefix = [] | 32 cmd_prefix = [] |
33 | 33 |
34 if use_retry_wrapper: | 34 if use_retry_wrapper: |
35 # We pass the real gsutil_path to the wrapper so it doesn't have to do | 35 # We pass the real gsutil_path to the wrapper so it doesn't have to do |
36 # brittle path logic. | 36 # brittle path logic. |
37 cmd_prefix = ['--', gsutil_path] | 37 cmd_prefix = ['--', gsutil_path] |
38 gsutil_path = self.resource('gsutil_wrapper.py') | 38 gsutil_path = self.resource('gsutil_wrapper.py') |
39 | 39 |
40 if version: | 40 if version: |
41 cmd_prefix.extend(['--force-version', version]) | 41 cmd_prefix.extend(['--force-version', version]) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 'Content-Language', | 202 'Content-Language', |
203 'Content-MD5', | 203 'Content-MD5', |
204 'Content-Type', | 204 'Content-Type', |
205 ): | 205 ): |
206 return name | 206 return name |
207 | 207 |
208 # Add provider prefix | 208 # Add provider prefix |
209 if not provider_prefix: | 209 if not provider_prefix: |
210 provider_prefix = 'x-goog-meta' | 210 provider_prefix = 'x-goog-meta' |
211 return '%s-%s' % (provider_prefix, name) | 211 return '%s-%s' % (provider_prefix, name) |
OLD | NEW |