Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: scripts/slave/recipe_modules/step/api.py

Issue 187203005: Minor cleanup of some recipe framework code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 from slave import recipe_util 6 from slave import recipe_util
7 7
8 class StepApi(recipe_api.RecipeApi): 8 class StepApi(recipe_api.RecipeApi):
9 def __init__(self, *args, **kwargs): 9 def __init__(self, **kwargs):
10 super(StepApi, self).__init__(**kwargs)
Vadim Sh. 2014/03/05 06:09:30 This seems to be more in line with other modules.
iannucci 2014/03/05 20:43:37 Yeah, no reason not to.
10 self._auto_resolve_conflicts = False 11 self._auto_resolve_conflicts = False
11 self._name_function = None 12 self._name_function = None
12 self._step_names = {} 13 self._step_names = {}
13 super(StepApi, self).__init__(*args, **kwargs)
14 14
15 # Making these properties makes them show up in show_me_the_modules, 15 # Making these properties makes them show up in show_me_the_modules,
16 # and also makes it clear that they are intended to be mutated. 16 # and also makes it clear that they are intended to be mutated.
17 @property 17 @property
18 def auto_resolve_conflicts(self): 18 def auto_resolve_conflicts(self):
19 """Automatically resolve step name conflicts.""" 19 """Automatically resolve step name conflicts."""
20 return self._auto_resolve_conflicts 20 return self._auto_resolve_conflicts
21 21
22 @auto_resolve_conflicts.setter 22 @auto_resolve_conflicts.setter
23 def auto_resolve_conflicts(self, val): 23 def auto_resolve_conflicts(self, val):
(...skipping 26 matching lines...) Expand all
50 step_count = self._step_names.setdefault(name, 0) + 1 50 step_count = self._step_names.setdefault(name, 0) + 1
51 self._step_names[name] = step_count 51 self._step_names[name] = step_count
52 if step_count > 1: 52 if step_count > 1:
53 name = "%s (%d)" % (name, step_count) 53 name = "%s (%d)" % (name, step_count)
54 kwargs.update({'name': name, 'cmd': cmd}) 54 kwargs.update({'name': name, 'cmd': cmd})
55 55
56 schema = self.make_config() 56 schema = self.make_config()
57 schema.set_val(kwargs) 57 schema.set_val(kwargs)
58 58
59 return schema.as_jsonish() 59 return schema.as_jsonish()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698