| OLD | NEW |
| 1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be 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 collections | 7 import collections |
| 8 import copy | 8 import copy |
| 9 import keyword | 9 import keyword |
| 10 import re | 10 import re |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 name (str): the name of the recipe engine client to install. | 81 name (str): the name of the recipe engine client to install. |
| 82 """ | 82 """ |
| 83 return _UnresolvedRequirement('client', name) | 83 return _UnresolvedRequirement('client', name) |
| 84 | 84 |
| 85 | 85 |
| 86 class PropertiesClient(object): | 86 class PropertiesClient(object): |
| 87 """A recipe engine client representing the recipe engine properties.""" | 87 """A recipe engine client representing the recipe engine properties.""" |
| 88 | 88 |
| 89 IDENT = 'properties' | 89 IDENT = 'properties' |
| 90 | 90 |
| 91 def __init__(self, engine): | 91 def __init__(self, properties): |
| 92 self._engine = engine | 92 self._properties = properties |
| 93 | 93 |
| 94 def get_properties(self): | 94 def get_properties(self): |
| 95 return copy.deepcopy(self._engine.properties) | 95 return copy.deepcopy(self._properties) |
| 96 | 96 |
| 97 | 97 |
| 98 class StepClient(object): | 98 class StepClient(object): |
| 99 """A recipe engine client representing step running and introspection.""" | 99 """A recipe engine client representing step running and introspection.""" |
| 100 | 100 |
| 101 IDENT = 'step' | 101 IDENT = 'step' |
| 102 | 102 |
| 103 def __init__(self, engine): | 103 def __init__(self, engine): |
| 104 self._engine = engine | 104 self._engine = engine |
| 105 | 105 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 120 | 120 |
| 121 Args: | 121 Args: |
| 122 step_dict (dict): A step dictionary to run. | 122 step_dict (dict): A step dictionary to run. |
| 123 | 123 |
| 124 Returns: | 124 Returns: |
| 125 A StepData object containing the result of running the step. | 125 A StepData object containing the result of running the step. |
| 126 """ | 126 """ |
| 127 return self._engine.run_step(StepConfig.create(**step_dict)) | 127 return self._engine.run_step(StepConfig.create(**step_dict)) |
| 128 | 128 |
| 129 | 129 |
| 130 class PlatformClient(object): |
| 131 """A recipe engine client to expose a common view of the running platform.""" |
| 132 |
| 133 IDENT = 'platform' |
| 134 |
| 135 def __init__(self, plat): |
| 136 self._plat = plat |
| 137 |
| 138 # Export normalization methods. |
| 139 self.norm_plat = plat.norm_plat |
| 140 self.norm_bits = plat.norm_bits |
| 141 |
| 142 @property |
| 143 def name(self): |
| 144 return self._plat.name |
| 145 |
| 146 @property |
| 147 def bits(self): |
| 148 return self._plat.bits |
| 149 |
| 150 @property |
| 151 def arch(self): |
| 152 return self._plat.arch |
| 153 |
| 154 |
| 130 class DependencyManagerClient(object): | 155 class DependencyManagerClient(object): |
| 131 """A recipe engine client representing the dependency manager.""" | 156 """A recipe engine client representing the dependency manager.""" |
| 132 | 157 |
| 133 IDENT = 'dependency_manager' | 158 IDENT = 'dependency_manager' |
| 134 | 159 |
| 135 def __init__(self, engine): | 160 def __init__(self, engine): |
| 136 self._engine = engine | 161 self._engine = engine |
| 137 | 162 |
| 138 def depend_on(self, recipe, properties, **kwargs): | 163 def depend_on(self, recipe, properties, **kwargs): |
| 139 return self._engine.depend_on(recipe, properties, **kwargs) | 164 return self._engine.depend_on(recipe, properties, **kwargs) |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 """ | 953 """ |
| 929 Gets the BoundProperty version of this Property. Requires a name. | 954 Gets the BoundProperty version of this Property. Requires a name. |
| 930 """ | 955 """ |
| 931 return BoundProperty( | 956 return BoundProperty( |
| 932 self._default, self.help, self.kind, name, property_type, module, | 957 self._default, self.help, self.kind, name, property_type, module, |
| 933 self.param_name) | 958 self.param_name) |
| 934 | 959 |
| 935 class UndefinedPropertyException(TypeError): | 960 class UndefinedPropertyException(TypeError): |
| 936 pass | 961 pass |
| 937 | 962 |
| OLD | NEW |