Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 | |
| 2 from slave.recipe_config import config_item_context, ConfigGroup, Dict, Static | |
| 3 | |
| 4 from slave.recipe_config_types import Path | |
|
agable
2013/09/26 21:46:02
No empty line above this.
iannucci
2013/09/27 02:08:20
Done.
| |
| 5 | |
| 6 def BaseConfig(CURRENT_WORKING_DIR, **_kwargs): | |
| 7 assert CURRENT_WORKING_DIR[0].endswith(('\\', '/')) | |
| 8 return ConfigGroup( | |
| 9 # base path name -> [tokenized absolute path] | |
| 10 base_paths = Dict(value_type=tuple), | |
| 11 | |
| 12 # dynamic path name -> Path object (referencing one of the base_paths) | |
| 13 dynamic_paths = Dict(value_type=(Path, type(None))), | |
| 14 | |
| 15 CURRENT_WORKING_DIR = Static(tuple(CURRENT_WORKING_DIR)), | |
| 16 ) | |
| 17 | |
| 18 VAR_TEST_MAP = { | |
| 19 'CURRENT_WORKING_DIR': ( | |
| 20 ['/', 'b', 'build', 'slave', 'fake_slave', 'build'], | |
| 21 ['D:\\', 'build', 'slave', 'fake_slave', 'build'], | |
|
agable
2013/09/26 21:46:02
It's generally E:\\b\build...
iannucci
2013/09/27 02:08:20
Done.
agable
2013/09/27 17:48:16
You're still missing the \b\ part of the path.
| |
| 22 ), | |
| 23 } | |
| 24 | |
| 25 def test_name(args): | |
| 26 if args['CURRENT_WORKING_DIR'][0] == '/': | |
| 27 return 'posix' | |
| 28 else: | |
| 29 return 'windows' | |
| 30 | |
| 31 config_ctx = config_item_context(BaseConfig, VAR_TEST_MAP, test_name) | |
| 32 | |
| 33 @config_ctx(is_root=True) | |
| 34 def BASE(c): | |
| 35 c.base_paths['cwd'] = c.CURRENT_WORKING_DIR | |
| 36 | |
| 37 @config_ctx() | |
| 38 def buildbot(c): | |
| 39 c.base_paths['root'] = c.CURRENT_WORKING_DIR[:-4] | |
|
agable
2013/09/26 21:46:02
Magic number! Comment it.
iannucci
2013/09/27 02:08:20
This IS the comment... the root path is 4 levels u
| |
| 40 c.base_paths['slave_build'] = c.CURRENT_WORKING_DIR | |
| 41 for token in ('build_internal', 'build', 'depot_tools'): | |
| 42 c.base_paths[token] = c.base_paths['root'] + (token,) | |
| 43 c.dynamic_paths['checkout'] = None | |
| 44 | |
| OLD | NEW |