| OLD | NEW |
| 1 # Copyright 2013 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 """Recipe Configuration Meta DSL. | 5 """Recipe Configuration Meta DSL. |
| 6 | 6 |
| 7 This module contains, essentially, a DSL for writing composable configurations. | 7 This module contains, essentially, a DSL for writing composable configurations. |
| 8 You start by defining a schema which describes how your configuration blobs will | 8 You start by defining a schema which describes how your configuration blobs will |
| 9 be structured, and what data they can contain. For example: | 9 be structured, and what data they can contain. For example: |
| 10 | 10 |
| 11 FakeSchema = lambda main_val=True, mode='Happy': ConfigGroup( | 11 FakeSchema = lambda main_val=True, mode='Happy': ConfigGroup( |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 def default_config_vars(): | 263 def default_config_vars(): |
| 264 ret = {} | 264 ret = {} |
| 265 for include in includes or []: | 265 for include in includes or []: |
| 266 item = self.CONFIG_ITEMS[include] | 266 item = self.CONFIG_ITEMS[include] |
| 267 ret.update(item.DEFAULT_CONFIG_VARS()) | 267 ret.update(item.DEFAULT_CONFIG_VARS()) |
| 268 if config_vars: | 268 if config_vars: |
| 269 ret.update(config_vars) | 269 ret.update(config_vars) |
| 270 return ret | 270 return ret |
| 271 inner.DEFAULT_CONFIG_VARS = default_config_vars | 271 inner.DEFAULT_CONFIG_VARS = default_config_vars |
| 272 | 272 |
| 273 assert name not in self.CONFIG_ITEMS | 273 assert name not in self.CONFIG_ITEMS, ( |
| 274 '%s is already in CONFIG_ITEMS' % name) |
| 274 self.CONFIG_ITEMS[name] = inner | 275 self.CONFIG_ITEMS[name] = inner |
| 275 if group: | 276 if group: |
| 276 self.MUTEX_GROUPS.setdefault(group, set()).add(name) | 277 self.MUTEX_GROUPS.setdefault(group, set()).add(name) |
| 277 inner.IS_ROOT = is_root | 278 inner.IS_ROOT = is_root |
| 278 if is_root: | 279 if is_root: |
| 279 assert not self.ROOT_CONFIG_ITEM, ( | 280 assert not self.ROOT_CONFIG_ITEM, ( |
| 280 'may only have one root config_ctx!') | 281 'may only have one root config_ctx!') |
| 281 self.ROOT_CONFIG_ITEM = inner | 282 self.ROOT_CONFIG_ITEM = inner |
| 282 inner.IS_ROOT = True | 283 inner.IS_ROOT = True |
| 283 inner.NO_TEST = no_test or bool(deps) | 284 inner.NO_TEST = no_test or bool(deps) |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 return self.data | 784 return self.data |
| 784 | 785 |
| 785 def reset(self): | 786 def reset(self): |
| 786 assert False | 787 assert False |
| 787 | 788 |
| 788 def complete(self): | 789 def complete(self): |
| 789 return True | 790 return True |
| 790 | 791 |
| 791 def _is_default(self): | 792 def _is_default(self): |
| 792 return True | 793 return True |
| OLD | NEW |