Index: recipe_engine/recipe_api.py |
diff --git a/recipe_engine/recipe_api.py b/recipe_engine/recipe_api.py |
index 8827e4c4cf81994edf679d5d216406a3d7829fd6..e69984ed718bd97b913c7ab6bfe73fe84e30f00c 100644 |
--- a/recipe_engine/recipe_api.py |
+++ b/recipe_engine/recipe_api.py |
@@ -84,15 +84,24 @@ def RequireClient(name): |
class PropertiesClient(object): |
- """A recipe engine client representing the recipe engine properties.""" |
+ """A recipe engine client representing the recipe engine properties. |
+ |
+ The retained properties are frozen, and can be safely passed around. |
+ """ |
IDENT = 'properties' |
- def __init__(self, engine): |
- self._engine = engine |
+ def __init__(self, rt): |
+ self._rt = rt |
+ |
+ @property |
+ def properties(self): |
+ """Returns (types.FrozenDict): Frozen properties.""" |
+ return self._rt.properties |
- def get_properties(self): |
- return copy.deepcopy(self._engine.properties) |
+ def mutable_properties(self): |
iannucci
2016/10/19 16:41:03
this seems really dangerous to me; we've never exp
dnj
2016/10/19 16:44:05
The mutable properties function returns a deepcopy
|
+ """Returns (dict): Mutable original properties dict.""" |
+ return self._rt.mutable_properties() |
class StepClient(object): |
@@ -127,6 +136,36 @@ class StepClient(object): |
return self._engine.run_step(StepConfig.create(**step_dict)) |
+class PlatformClient(object): |
+ """A recipe engine client to expose a common view of the running platform.""" |
+ |
+ IDENT = 'platform' |
+ |
+ def __init__(self, plat): |
+ self._plat = plat |
+ |
+ # Export normalization methods. |
+ self.norm_plat = plat.norm_plat |
+ self.norm_bits = plat.norm_bits |
+ |
+ # Export platform constants. |
+ self.WIN = plat.WIN |
+ self.LINUX = plat.LINUX |
+ self.MAC = plat.MAC |
+ |
+ @property |
+ def name(self): |
+ return self._plat.name |
+ |
+ @property |
+ def bits(self): |
+ return self._plat.bits |
+ |
+ @property |
+ def arch(self): |
+ return self._plat.arch |
+ |
+ |
class DependencyManagerClient(object): |
"""A recipe engine client representing the dependency manager.""" |