Chromium Code Reviews| Index: recipe_modules/path/config.py |
| diff --git a/recipe_modules/path/config.py b/recipe_modules/path/config.py |
| index d86c4e4bcdefe43c800a22f9359d5cef4cd6aac6..2f99779b7ee5efcaaedeecab640839f1de884f22 100644 |
| --- a/recipe_modules/path/config.py |
| +++ b/recipe_modules/path/config.py |
| @@ -4,8 +4,9 @@ |
| from recipe_engine.config import config_item_context, ConfigGroup, Dict, Static |
| from recipe_engine.config_types import Path |
| +from recipe_engine.types import FrozenDict |
| -def BaseConfig(CURRENT_WORKING_DIR, TEMP_DIR, **_kwargs): |
| +def BaseConfig(CURRENT_WORKING_DIR, TEMP_DIR, BASE_PATH_OVERRIDES, **_kwargs): |
| assert CURRENT_WORKING_DIR[0].endswith(('\\', '/')) |
| assert TEMP_DIR[0].endswith(('\\', '/')) |
| return ConfigGroup( |
| @@ -17,6 +18,7 @@ def BaseConfig(CURRENT_WORKING_DIR, TEMP_DIR, **_kwargs): |
| CURRENT_WORKING_DIR = Static(tuple(CURRENT_WORKING_DIR)), |
| TEMP_DIR = Static(tuple(TEMP_DIR)), |
| + BASE_PATH_OVERRIDES = Static(FrozenDict(BASE_PATH_OVERRIDES)), |
| ) |
| def test_name(args): # pragma: no cover |
| @@ -31,22 +33,24 @@ config_ctx = config_item_context(BaseConfig) |
| def BASE(c): |
| c.base_paths['cwd'] = c.CURRENT_WORKING_DIR |
| c.base_paths['tmp_base'] = c.TEMP_DIR |
| + for k, v in c.BASE_PATH_OVERRIDES.iteritems(): |
| + c.base_paths[k] = v # pragma: no cover |
| @config_ctx() |
| def buildbot(c): |
| - c.base_paths['root'] = c.CURRENT_WORKING_DIR[:-4] |
| - c.base_paths['slave_build'] = c.CURRENT_WORKING_DIR |
| + c.base_paths.setdefault('root', c.CURRENT_WORKING_DIR[:-4]) |
| + c.base_paths.setdefault('slave_build', c.CURRENT_WORKING_DIR) |
| for token in ('build_internal', 'build', 'depot_tools'): |
| - c.base_paths[token] = c.base_paths['root'] + (token,) |
| + c.base_paths.setdefault(token, c.base_paths['root'] + (token,)) |
| c.dynamic_paths['checkout'] = None |
| @config_ctx() |
| def example(c): |
| - c.base_paths['slave_build'] = c.CURRENT_WORKING_DIR |
| + c.base_paths.setdefault('slave_build', c.CURRENT_WORKING_DIR) |
| c.dynamic_paths['borts'] = None |
| @config_ctx(includes=['buildbot']) |
| def swarming(c): |
| - c.base_paths['slave_build'] = ( |
| + c.base_paths.setdefault('slave_build', ( |
|
martiniss
2016/01/19 23:29:37
This won't work as is.... base_paths already has a
|
| c.CURRENT_WORKING_DIR[:1] + |
| - ('b', 'fake_build', 'slave', 'fake_slave', 'build')) |
| + ('b', 'fake_build', 'slave', 'fake_slave', 'build'))) |