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