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 from slave import recipe_api | 5 from slave import recipe_api |
6 | 6 |
7 GIT_DEFAULT_WHITELIST = frozenset(( | 7 GIT_DEFAULT_WHITELIST = frozenset(( |
8 'tools_build', | 8 'tools_build', |
9 )) | 9 )) |
10 | 10 |
11 def jsonish_to_python(spec, is_top=False): | 11 def jsonish_to_python(spec, is_top=False): |
12 ret = '' | 12 ret = '' |
13 if is_top: # We're the 'top' level, so treat this dict as a suite. | 13 if is_top: # We're the 'top' level, so treat this dict as a suite. |
14 ret = '\n'.join( | 14 ret = '\n'.join( |
15 '%s = %s' % (k, jsonish_to_python(spec[k])) for k in sorted(spec) | 15 '%s = %s' % (k, jsonish_to_python(spec[k])) for k in sorted(spec) |
16 ) | 16 ) |
17 else: | 17 else: |
18 if isinstance(spec, dict): | 18 if isinstance(spec, dict): |
19 ret += '{' | 19 ret += '{' |
20 ret += ', '.join( | 20 ret += ', '.join( |
21 "%s: %s" % (repr(str(k)), jsonish_to_python(spec[k])) for k in sorted(sp
ec)) | 21 "%s: %s" % (repr(str(k)), jsonish_to_python(spec[k])) |
| 22 for k in sorted(spec) |
| 23 ) |
22 ret += '}' | 24 ret += '}' |
23 elif isinstance(spec, list): | 25 elif isinstance(spec, list): |
24 ret += '[' | 26 ret += '[' |
25 ret += ', '.join(jsonish_to_python(x) for x in spec) | 27 ret += ', '.join(jsonish_to_python(x) for x in spec) |
26 ret += ']' | 28 ret += ']' |
27 elif isinstance(spec, basestring): | 29 elif isinstance(spec, basestring): |
28 ret = repr(str(spec)) | 30 ret = repr(str(spec)) |
29 else: | 31 else: |
30 ret = repr(spec) | 32 ret = repr(spec) |
31 return ret | 33 return ret |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return self.m.python(prefix + 'revert', | 147 return self.m.python(prefix + 'revert', |
146 self.m.path.build('scripts', 'slave', 'gclient_safe_revert.py'), | 148 self.m.path.build('scripts', 'slave', 'gclient_safe_revert.py'), |
147 ['.', self.m.path.depot_tools('gclient', wrapper=True)], | 149 ['.', self.m.path.depot_tools('gclient', wrapper=True)], |
148 ) | 150 ) |
149 | 151 |
150 def runhooks(self, args=None, **kwargs): | 152 def runhooks(self, args=None, **kwargs): |
151 """Return a 'gclient runhooks' step.""" | 153 """Return a 'gclient runhooks' step.""" |
152 args = args or [] | 154 args = args or [] |
153 assert isinstance(args, (list, tuple)) | 155 assert isinstance(args, (list, tuple)) |
154 return self('runhooks', ['runhooks'] + list(args), **kwargs) | 156 return self('runhooks', ['runhooks'] + list(args), **kwargs) |
OLD | NEW |