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

Side by Side Diff: recipe_engine/recipe_api.py

Issue 1421843006: Add simple depends_on API. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Made it do properties and multi Created 5 years, 1 month 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
OLDNEW
1 # Copyright 2013-2015 The Chromium Authors. All rights reserved. 1 # Copyright 2013-2015 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 __future__ import absolute_import 5 from __future__ import absolute_import
6 import contextlib 6 import contextlib
7 import json
luqui 2015/11/16 20:47:59 I think all of these new imports are unused.
martiniss 2015/11/18 01:00:00 Correct!
7 import keyword 8 import keyword
9 import os
8 import re 10 import re
11 import subprocess
12 import tempfile
9 import types 13 import types
10 14
11 from functools import wraps 15 from functools import wraps
12 16
13 from .recipe_test_api import DisabledTestData, ModuleTestData 17 from .recipe_test_api import DisabledTestData, ModuleTestData
14 from .config import Single 18 from .config import Single
15 19
16 from .util import ModuleInjectionSite 20 from .util import ModuleInjectionSite
17 21
18 from . import field_composer 22 from . import field_composer
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 @property 451 @property
448 def name(self): 452 def name(self):
449 return self._module.NAME 453 return self._module.NAME
450 454
451 455
452 class RecipeApi(RecipeApiPlain): 456 class RecipeApi(RecipeApiPlain):
453 __metaclass__ = RecipeApiMeta 457 __metaclass__ = RecipeApiMeta
454 458
455 459
456 class RecipeScriptApi(RecipeApiPlain, ModuleInjectionSite): 460 class RecipeScriptApi(RecipeApiPlain, ModuleInjectionSite):
457 pass 461 def depend_on(self, recipe, properties, **kwargs):
462 return self._engine.depend_on(recipe, properties, **kwargs)
458 463
464 def depend_on_test(self, recipe, properties, value, **kwargs):
465 return self._engine.depend_on_test(recipe, properties, value, **kwargs)
459 466
460 # This is a sentinel object for the Property system. This allows users to 467 # This is a sentinel object for the Property system. This allows users to
461 # specify a default of None that will actually be respected. 468 # specify a default of None that will actually be respected.
462 PROPERTY_SENTINEL = object() 469 PROPERTY_SENTINEL = object()
463 470
464 class BoundProperty(object): 471 class BoundProperty(object):
465 """ 472 """
466 A bound, named version of a Property. 473 A bound, named version of a Property.
467 474
468 A BoundProperty is different than a Property, in that it requires a name, 475 A BoundProperty is different than a Property, in that it requires a name,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 """ 635 """
629 Gets the BoundProperty version of this Property. Requires a name. 636 Gets the BoundProperty version of this Property. Requires a name.
630 """ 637 """
631 return BoundProperty( 638 return BoundProperty(
632 self._default, self.help, self.kind, name, property_type, module, 639 self._default, self.help, self.kind, name, property_type, module,
633 self.param_name) 640 self.param_name)
634 641
635 class UndefinedPropertyException(TypeError): 642 class UndefinedPropertyException(TypeError):
636 pass 643 pass
637 644
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698